Browse Source

fix #13573 (#13843)

Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
tags/1.0.0
kenwoodjw 8 months ago
parent
commit
b09f22961c
No account linked to committer's email address
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      api/controllers/files/image_preview.py

+ 4
- 1
api/controllers/files/image_preview.py View File

@@ -1,3 +1,5 @@
from urllib.parse import quote

from flask import Response, request
from flask_restful import Resource, reqparse # type: ignore
from werkzeug.exceptions import NotFound
@@ -71,7 +73,8 @@ class FilePreviewApi(Resource):
if upload_file.size > 0:
response.headers["Content-Length"] = str(upload_file.size)
if args["as_attachment"]:
response.headers["Content-Disposition"] = f"attachment; filename={upload_file.name}"
encoded_filename = quote(upload_file.name)
response.headers["Content-Disposition"] = f"attachment; filename*=UTF-8''{encoded_filename}"

return response


Loading…
Cancel
Save