Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix: 下载文件不支持中文等非 ASCII 字符文件名

haowenzhong1c2b280996889
diff --git a/jiuwenclaw/channels/web/app_web.py b/jiuwenclaw/channels/web/app_web.py
index 5bdfddca04..75fc2f0fdb 100644
--- a/jiuwenclaw/channels/web/app_web.py
+++ b/jiuwenclaw/channels/web/app_web.py
@@ -21,7 +21,7 @@ from functools import partial
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from typing import Any
-from urllib.parse import unquote, urlparse
+from urllib.parse import quote, unquote, urlparse
# --- Early --dotenv parsing (before jiuwenclaw imports) ---
from jiuwenclaw.dotenv_early import parse_dotenv_early
@@ -678,9 +678,10 @@ class _SpaStaticHandler(SimpleHTTPRequestHandler):
self.send_response(200)
self.send_header("Content-Type", mime_type)
self.send_header("Content-Length", str(file_size))
+ encoded_name = quote(file_name, safe="")
self.send_header(
"Content-Disposition",
- f'attachment; filename="{file_name}"',
+ f"attachment; filename*=UTF-8''{encoded_name}",
)
self.send_header("Cache-Control", "no-store")
self.end_headers()