storage
This commit is contained in:
parent
006c8de201
commit
863d64b53a
|
|
@ -169,10 +169,11 @@ func (s *Minio) Fetch(urlStr, objectName string) error {
|
||||||
|
|
||||||
// 获取文件名和 Content-Type
|
// 获取文件名和 Content-Type
|
||||||
objectName = strings.TrimLeft(objectName, "/ ")
|
objectName = strings.TrimLeft(objectName, "/ ")
|
||||||
contentType := resp.Header.Get("Content-Type")
|
// 优先根据文件扩展名推断 Content-Type,确保图片能正确预览
|
||||||
|
ext := strings.TrimLeft(path.Ext(objectName), ".")
|
||||||
|
contentType := ext2ContentType(ext)
|
||||||
if contentType == "" {
|
if contentType == "" {
|
||||||
ext := strings.TrimLeft(path.Ext(objectName), ".")
|
contentType = resp.Header.Get("Content-Type")
|
||||||
contentType = ext2ContentType(ext)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传到 MinIO
|
// 上传到 MinIO
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue