fix(storage) handle download filename

This commit is contained in:
neo-f
2023-03-23 22:54:18 +08:00
parent 50713cdbd8
commit b23b3ee550
2 changed files with 7 additions and 4 deletions

View File

@@ -73,7 +73,7 @@ func (df *DocFolderWithChildren) ToTreeSchema() *schema.DocFolderWithChildren {
type Doc struct {
Base
Name string `gorm:"column:name;type:varchar;not null"` // 文件名称
Name string `gorm:"column:name;type:varchar;not null"` // 文件名称
IsDeletable bool `gorm:"column:is_deletable;type:boolean;not null;default:true"` // 是否允许被删除
IsEditable bool `gorm:"column:is_editable;type:boolean;not null;default:true"` // 是否允许编辑名称
FolderID string `gorm:"column:folder_id;type:varchar;index:idx_folder_id"` // 文件夹ID
@@ -98,7 +98,7 @@ func (d *Doc) ToSchema(ctx context.Context) *schema.Doc {
}
func (d *Doc) PresignedURL(ctx context.Context) (*url.URL, error) {
return dal.GetStorage().PresignedGetObject(ctx, d.ObjectName, time.Hour)
return dal.GetStorage().PresignedGetObject(ctx, d.ObjectName, time.Hour, d.Name)
}
func (*Doc) TableName() string {