功能(文档与桌面):完善文件预览下载与客户端构建基线
Client Quality Gates / Shared client and Web (push) Has been cancelled
Client Quality Gates / macOS Desktop (push) Has been cancelled

- 保存文档版本原始文件名,规范下载响应并持久化上传目录\n- 增加 PDF.js 预览、桌面保存打开流程及统一错误反馈\n- 统一 Node.js 22.13 构建基线并收紧临时文件权限门禁\n- 补充迁移、单元测试、发布检查与运维文档
This commit is contained in:
Cheng Zhou
2026-07-13 18:40:48 +08:00
parent ab59476d10
commit 44db5db838
40 changed files with 1817 additions and 87 deletions
+22
View File
@@ -0,0 +1,22 @@
from types import SimpleNamespace
from app.services.document_service import _content_disposition, _legacy_download_filename, _safe_original_filename
def test_safe_original_filename_strips_paths_and_control_characters():
assert _safe_original_filename(r"C:\fakepath\研究方案.xlsx") == "研究方案.xlsx"
assert _safe_original_filename("../研究\n方案.xlsx") == "研究方案.xlsx"
def test_content_disposition_preserves_unicode_filename():
header = _content_disposition("研究方案 V1.0.xlsx")
assert header.startswith('attachment; filename="')
assert "filename*=UTF-8''%E7%A0%94%E7%A9%B6%E6%96%B9%E6%A1%88%20V1.0.xlsx" in header
def test_legacy_download_filename_uses_document_title_instead_of_storage_uuid():
version = SimpleNamespace(file_uri="/uploads/fa6ab7ab-f4f5-4d4a-a052-693f780010fd.pdf")
assert _legacy_download_filename(version, SimpleNamespace(title="研究方案")) == "研究方案.pdf"
assert _legacy_download_filename(version, SimpleNamespace(title="研究方案.PDF")) == "研究方案.PDF"