feat: 优化编辑器 UI 和文件名显示,支持全屏编辑模式
This commit is contained in:
@@ -248,7 +248,8 @@ func (s *common) CompleteUpload(ctx context.Context, userID int64, form *common_
|
||||
ObjectKey: objectKey,
|
||||
Hash: hash,
|
||||
Meta: types.NewJSONType(fields.MediaAssetMeta{
|
||||
Size: totalSize,
|
||||
Filename: meta.Filename,
|
||||
Size: totalSize,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@@ -384,7 +385,8 @@ func (s *common) Upload(
|
||||
ObjectKey: objectKey,
|
||||
Hash: hash,
|
||||
Meta: types.NewJSONType(fields.MediaAssetMeta{
|
||||
Size: size,
|
||||
Filename: file.Filename,
|
||||
Size: size,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@@ -398,10 +400,14 @@ func (s *common) Upload(
|
||||
|
||||
func (s *common) composeUploadResult(asset *models.MediaAsset) *common_dto.UploadResult {
|
||||
url := s.GetAssetURL(asset.ObjectKey)
|
||||
filename := filepath.Base(asset.ObjectKey)
|
||||
// Try to get original filename if stored? Currently objectKey has UUID prefix.
|
||||
// We can store original filename in Meta if needed. For now, just return valid result.
|
||||
// Meta is JSONType wrapper.
|
||||
filename := asset.Meta.Data().Filename
|
||||
if filename == "" {
|
||||
filename = filepath.Base(asset.ObjectKey)
|
||||
// Try to strip UUID prefix (36 chars + 1 underscore = 37)
|
||||
if len(filename) > 37 && filename[36] == '_' {
|
||||
filename = filename[37:]
|
||||
}
|
||||
}
|
||||
size := asset.Meta.Data().Size
|
||||
|
||||
return &common_dto.UploadResult{
|
||||
|
||||
Reference in New Issue
Block a user