Repository navigation
test(server): cover download filename edge cases - #4790
Conversation
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56c8eea0e7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Requirement or Bug
#4563 已修复非 ASCII 文件名导致下载响应头失败的问题,并于 2026-11-10 合入 main(
1eb3c537e)。原回归只覆盖一个中文 PNG。本 PR 只补齐边界回归,防止 Desktop / Web 的 PDF 与媒体预览再次受文件名编码问题影响。本 PR 不重复实现 #4563,也不改变运行时代码。#2286 的同类 sanitize 修复已由 #4563 取代,建议维护者关闭 #2286,避免继续分叉。
Bug Reproduction Steps
/api/v1/sessions/:id/fs/:path:download下载文件。Root Cause
#4563 已定位并修复根因:原始非 ASCII 文件名不能直接写入 Node 的
Content-Disposition响应头。本 PR 处理的是回归覆盖缺口,不引入另一套修复。Code Changes
将原有单个中文 PNG 用例扩展为同一路由的参数化回归矩阵:
attachment; filename="...",不添加filename*。filename参数,原文件名仅以 RFC 5987 编码出现在filename*。win32上过滤,其余三组保留跨平台覆盖。Screenshots / Recordings
同一真实 kap-server 下,Desktop 与 Web 均通过真实 Markdown 文件链接打开中文 PDF 与 PNG。四象限依次为 Desktop PDF、Desktop PNG、Web PDF、Web PNG;PDF 真实渲染,PNG 实际显示,UI 响应字节均与源文件一致。
Behavior Changes and Affected Users
None。仅修改
packages/kap-server/test/fs.test.ts;下载路由、路径解析、MIME、文件字节和客户端行为均未改变。反馈边界:Bug 收敛记录
53825081-cba9-41e9-88a6-2388b086e6fe同时包含另一种 HTTP 200 错误 envelope 机制。本 PR 不宣称关闭该记录,也不覆盖路径解析或大文件截断问题。验证:
0125dbb20+ 同一测试补丁:4 个非 ASCII / 转义用例失败,普通 ASCII 用例通过。packages/kap-server/test/fs.test.ts:70/70 通过。pnpm typecheck:通过。pnpm lint:0 errors;既有 warnings 不属于本 PR。fb2de0791的 CI:16 项成功,test-windows按既有条件跳过。1eb3c537e+ kcaf54db65b,Desktop 1.3.2 / Electron 43.1.1 与 Chrome Web 使用同一真实 kap-server。Desktop / Web 的中文 PDF 与 PNG 预览 4/4 PASS;PDF 真实渲染,PNG 为 1000×640,UI 实际响应字节与源文件 SHA256 一致,未出现ERR_INVALID_CHAR。Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.