fix anwser token and database issus
This commit is contained in:
@@ -109,24 +109,22 @@ func uploadPictureToS3(file multipart.File, fileHeader *multipart.FileHeader, as
|
||||
return "", errors.Wrap(err, "reset reader")
|
||||
}
|
||||
|
||||
// 4. 根据格式进行转换或直接使用原图
|
||||
// 4. 按格式转换或直接使用原图
|
||||
switch format {
|
||||
case "gif":
|
||||
webpData, err := convertGifToAnimatedWebP(fileData)
|
||||
if err != nil {
|
||||
// 转换失败则回退到原始 GIF
|
||||
uploadData = fileData
|
||||
uploadData = fileData // 转换失败回退原始 GIF
|
||||
contentType = "image/gif"
|
||||
} else {
|
||||
uploadData = webpData
|
||||
contentType = "image/webp"
|
||||
}
|
||||
default:
|
||||
// 静态图片(JPEG / PNG / WebP 等)转换为静态 WebP
|
||||
// 静态图片(JPEG / PNG / WebP 等)转静态 WebP
|
||||
webpData, err := ConvertStaticImageToWebP(fileReader)
|
||||
if err != nil {
|
||||
// 转换失败时回退到原始图片
|
||||
uploadData = fileData
|
||||
uploadData = fileData // 转换失败回退原图
|
||||
contentType = mimeTypeFromFormat(format)
|
||||
} else {
|
||||
uploadData = webpData
|
||||
|
||||
Reference in New Issue
Block a user