feat: 上传文件到 oss 遇到错误时,应该返回错误,避免 panic (#1890)

This commit is contained in:
3vilive
2024-09-27 20:54:44 +08:00
committed by GitHub
parent b98094ceee
commit 4c46bdaa7f
2 changed files with 3 additions and 3 deletions

View File

@@ -92,7 +92,7 @@ func (e *FileUploadAndDownloadService) UploadFile(header *multipart.FileHeader,
oss := upload.NewOss()
filePath, key, uploadErr := oss.UploadFile(header)
if uploadErr != nil {
panic(uploadErr)
return file, uploadErr
}
s := strings.Split(header.Filename, ".")
f := example.ExaFileUploadAndDownload{