Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: some pdf with chinese name cannot preview (#18422)

Wang Qi86750bd24e10
diff --git a/api/utils/file_response.py b/api/utils/file_response.py
index f9f4751b55..1984b7c17e 100644
--- a/api/utils/file_response.py
+++ b/api/utils/file_response.py
@@ -80,7 +80,7 @@ def should_force_attachment(ext: str | None, content_type: str | None = None) ->
def sanitize_content_disposition_filename(filename: str | None) -> str | None:
if not filename:
return None
- base = re.sub(r"[^\w.\-]", "_", str(filename).split("/")[-1].split("\\")[-1])
+ base = re.sub(r"[^\w.\-]", "_", str(filename).split("/")[-1].split("\\")[-1], flags=re.ASCII)
return base or None