Skip to content

Commit 4bcfb80

Browse files
author
pikachuren
committed
fix(media): always return an array for media status types
1 parent a125c24 commit 4bcfb80

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎server/handles/media_extra.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ type MediaStatus struct {
3131

3232
// PublicMediaStatus 公开的媒体库状态
3333
func PublicMediaStatus(c *gin.Context) {
34-
status := MediaStatus{Enabled: MediaEnabled()}
34+
// Types 必须是非 nil 切片:前端会直接调用 .includes(),nil 序列化成 null 会抛异常
35+
status := MediaStatus{Enabled: MediaEnabled(), Types: []string{}}
3536
if !status.Enabled {
3637
common.SuccessResp(c, status)
3738
return

0 commit comments

Comments
 (0)