feat: 优化编辑器 UI 和文件名显示,支持全屏编辑模式
This commit is contained in:
@@ -370,7 +370,18 @@ func (s *creator) GetContent(ctx context.Context, userID int64, id string) (*cre
|
||||
|
||||
for _, ca := range c.ContentAssets {
|
||||
if ca.Asset != nil {
|
||||
sizeBytes := ca.Asset.Meta.Data().Size
|
||||
meta := ca.Asset.Meta.Data()
|
||||
name := meta.Filename
|
||||
if name == "" {
|
||||
// Fallback: strip UUID prefix (36 chars + 1 underscore = 37)
|
||||
if len(ca.Asset.ObjectKey) > 37 && ca.Asset.ObjectKey[36] == '_' {
|
||||
name = ca.Asset.ObjectKey[37:]
|
||||
} else {
|
||||
name = ca.Asset.ObjectKey
|
||||
}
|
||||
}
|
||||
|
||||
sizeBytes := meta.Size
|
||||
sizeMB := float64(sizeBytes) / 1024.0 / 1024.0
|
||||
sizeStr := cast.ToString(float64(int(sizeMB*100))/100.0) + " MB"
|
||||
|
||||
@@ -379,7 +390,7 @@ func (s *creator) GetContent(ctx context.Context, userID int64, id string) (*cre
|
||||
Role: string(ca.Role),
|
||||
Type: string(ca.Asset.Type),
|
||||
URL: Common.GetAssetURL(ca.Asset.ObjectKey),
|
||||
Name: ca.Asset.ObjectKey, // Simple fallback
|
||||
Name: name,
|
||||
Size: sizeStr,
|
||||
Sort: int(ca.Sort),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user