Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix #13573 (#13843)

kenwoodjwb09f22961ce3
diff --git a/api/controllers/files/image_preview.py b/api/controllers/files/image_preview.py
index 2357288a50a..6f39908b6e5 100644
--- a/api/controllers/files/image_preview.py
+++ b/api/controllers/files/image_preview.py
@@ -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