1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 22:18:07 +08:00

fix: 解决打开非文本文件报错的问题 (#5203)

This commit is contained in:
zhengkunwang 2024-05-29 18:43:13 +08:00 committed by GitHub
parent 9f3573bcb8
commit 86d021cbfc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -231,6 +231,9 @@ func (f *FileService) GetContent(op request.FileContentReq) (response.FileInfo,
Path: op.Path, Path: op.Path,
Expand: true, Expand: true,
}) })
if err != nil {
return response.FileInfo{}, err
}
content := []byte(info.Content) content := []byte(info.Content)
var decodeName string var decodeName string
@ -248,9 +251,6 @@ func (f *FileService) GetContent(op request.FileContentReq) (response.FileInfo,
} }
info.Content = string(contents) info.Content = string(contents)
} }
if err != nil {
return response.FileInfo{}, err
}
return response.FileInfo{FileInfo: *info}, nil return response.FileInfo{FileInfo: *info}, nil
} }