fix s3 download

This commit is contained in:
nyne
2025-05-23 15:13:26 +08:00
parent 0fae66c7dd
commit 22c17e5d9a

View File

@@ -58,7 +58,7 @@ func (s *S3Storage) Download(storageKey string, fileName string) (string, error)
return "", errors.New("failed to create S3 client") return "", errors.New("failed to create S3 client")
} }
reqParams := make(url.Values) reqParams := make(url.Values)
reqParams.Set("response-content-disposition", "attachment; filename=\""+fileName+"\"") reqParams.Set("response-content-disposition", "attachment; filename=\""+url.QueryEscape(fileName)+"\"")
presignedURL, err := minioClient.PresignedGetObject(context.Background(), s.BucketName, storageKey, 10*time.Second, reqParams) presignedURL, err := minioClient.PresignedGetObject(context.Background(), s.BucketName, storageKey, 10*time.Second, reqParams)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)