fix: image preview triggers binary download (#19070)

This commit is contained in:
xiaotian 2025-04-29 15:38:33 +08:00 committed by GitHub
parent 2a3cc43b62
commit 23f6914b9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,7 +75,7 @@ class FilePreviewApi(Resource):
if args["as_attachment"]: if args["as_attachment"]:
encoded_filename = quote(upload_file.name) encoded_filename = quote(upload_file.name)
response.headers["Content-Disposition"] = f"attachment; filename*=UTF-8''{encoded_filename}" response.headers["Content-Disposition"] = f"attachment; filename*=UTF-8''{encoded_filename}"
response.headers["Content-Type"] = "application/octet-stream" response.headers["Content-Type"] = "application/octet-stream"
return response return response