Skip to content

fix(desktop): open conversation MP4 attachments with the system player - #1123

Merged
vastsa merged 4 commits into
vastsa:mainfrom
yuxino:fix/conversation-video-attachments
Sep 27, 2026
Merged

vastsa merged 4 commits into
vastsa:mainfrom
yuxino:fix/conversation-video-attachments

Conversation

@yuxino

@yuxino yuxino commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

问题与修复

对话中发送 MP4 后,点击附件会进入内置文件页。该页把较大的 MP4 判为“文件过大”、较小的 MP4 判为二进制文件,因而没有可用的打开入口。现在文件页为 MP4 提供“用系统默认应用打开”。

对话附件的 MIME 会随文件引用传到文件页。主进程打开前重新校验真实路径与普通文件类型;无后缀的内容寻址 MP4 使用应用私有目录中的 .mp4 软链接交给系统,不复制视频字节。伪造 video/mp4 MIME 的脚本不会获得该入口。

验证

  • 当前任务候选:5c82c9271890;PR 目标 main:b14caaabe9e1;环境:macOS arm64。共享分支通过合并提交纳入新基线,未重写历史。
  • 新候选的 pnpm build:js、桌面 typecheck、pnpm lint、以 b14caaabe9e1 为基线的 pnpm check:pr-base:通过。pnpm docs:check、pnpm check:agent-policy 已在此前的 532c5e30c349 候选通过,本次基线合入未修改对应文件。
  • 新候选的 MP4 定向单测 7 项、Agent Runtime 单测 257 项:通过。此前候选的相关单测 31 项、i18n 测试 27 项:通过。
  • 新候选在允许原生进程启动的环境中重跑隔离 Electron pnpm test:e2e:composer-paste:通过。覆盖大 MP4 粘贴,以及大、小两种无后缀附件的对话 chip → 文件页 → 系统打开请求;伪造 MIME 不会为脚本显示打开按钮。

E2E 在系统打开边界记录交给 OS 的路径;隔离开发版已人工确认 QuickTime 打开并识别两段视频。下方录屏对比的是旧基线 78caf97795ee 与此前修复候选 532c5e30c349;此次上游合入只涉及 Host 配置同步、计划任务、用户技能和 Agent Runtime 的 shell 路径文案,未修改 MP4 实现。新候选已重跑相关 E2E,正式安装包尚未验收。此 PR 保持 Draft,供审阅与原生验收。

实际桌面录制

pi-desktop-pr1123-mp4-before-after-1080p.mp4

在隔离的 macOS Electron 实例中,使用系统文件选择器发送 936.8 KB 和 16.3 KB 的合成 MP4。旧版点击附件分别显示“File is too large to preview”和“Binary file — preview unavailable”,没有系统打开入口;候选版两种情况均显示“Open with default application”。点击后 QuickTime 分别打开隔离数据目录中的 6 秒和 2 秒 MP4。模型回复由 localhost fixture 提供;视频末尾 2 秒是实录帧定格,方便审阅。

Refs #1093

Conversation MP4 attachments reach the host file tab, where bounded
text preview reports binary or oversized content without a playback
action. Carry attachment MIME through chat resolution and offer a
user-initiated OS handoff for MP4 files.

Validate realpath containment before opening and give extensionless
stored blobs a private .mp4 alias. Cover pasted scratch files, blob
refs, spoofed MIME, and the representative Electron path.

Refs vastsa#1093
The English E2E traceability rows changed with the MP4 fix, but the
Chinese mirror kept the old table shape and failed docs:check. Sync the
scenario and related IPC and interaction descriptions across locales.

Refs vastsa#1093
The shared MP4 attachment branch must include the latest protected main before its Draft PR can be reviewed for landing. Preserve its existing commits and integrate the upstream attachment-history changes without rewriting published history.
Keep the published MP4 fix branch aligned with the PR target after upstream runtime and host changes. Preserve the existing fix commits without rewriting shared history.
@yuxino
yuxino marked this pull request as ready for review September 27, 2026 06:07
@vastsa
vastsa merged commit de2a528 into vastsa:main Sep 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants