Files
mnote/bugs/05-editor-mainline/done/5-34-local-folder-media-sign-office-url-contract-v1.md
lix-2026 1882db7681 收口 MNote P0 P1 P2 审查尾项
- 归档 OnlyOffice live bridge、Page AI、mindmap、design governance 与相关 bug 条目
- 补齐 MinerU OCR 后端 runtime 合同与 smoke/test 基线
- 收口 ChatOnly/Doubao、ObjectIdentity、Page Aggregate compat 与 runtime owner 文档口径

验证:
- cargo test --manifest-path rust/Cargo.toml -p mnote-web local_ocr -- --test-threads=1
- cargo test --manifest-path rust/Cargo.toml -p mnote-web onlyoffice_bridge -- --test-threads=1
- git diff --check
- git diff --cached --check
- codegraph index . --force && codegraph status .
- codegraph sync . && codegraph status .
2026-06-01 09:29:12 +08:00

47 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 5-34 local-folder media/sign 与 Office URL 契约
## 目标
OnlyOffice 打开 local-folder asset 时不再向 `/api/media/sign` 发起无意义请求;local 文件继续通过 local-folder open route 进入 OnlyOffice 只读预览。
## 原因
`/api/media/sign` 当前只签 Convex media asset。local-folder asset 已有 `rootUri + path` 的本地文件打开链路,不应混入 Convex 签名端点。
## 允许修改
- `rust/crates/mnote-web/src/routes/onlyoffice.rs`
- `rust/crates/mnote-web/src/ssr/pages/layout.rs`
- 相关 `mnote-web` 单测
## 禁止事项
- 不开放任意本地路径签名。
- 不把 `/api/media/sign` 扩成绕过 allowed roots 的本地文件下载端点。
- 不改变非 local Convex media asset 的签名行为。
## Checklist
- [x] `/onlyoffice` 页面识别 local asset / local fileUrl,跳过 `/api/media/sign`
- [x] local asset 的 doc key 仍稳定、安全,不包含 `/``:`、中文等危险字符。
- [x] 非 local asset 仍可走 `/api/media/sign` 解析 signedUrl。
- [x] 补单测覆盖 local asset 不依赖 media sign 的页面脚本契约。
## 验收
- `cargo test -p mnote-web onlyoffice -- --test-threads=1`
- `cargo test -p mnote-web -- --test-threads=1`
## 本轮执行记录
- 2026-05-21Reasonix worker A 执行完成。
-`page()` 模板 JS 中添加 `isLocalFolderAsset()` 守卫函数。
- `resolveAssetUrlAndKey()` 中 local-folder asset 跳过 `/api/media/sign`
- 守卫条件:`assetId` 前缀为 `local:``local-file:`,或 `fileUrl` 路径含 `/api/local-folder/files/open`
- 新增 `onlyoffice_page_skips_media_sign_for_local_folder_asset` 单测。
- `cargo test -p mnote-web onlyoffice -- --test-threads=1` 全部 13 项通过。
- 2026-05-21Codex 复核补充。
- 干净浏览器上下文上传并打开 `/home/lix/Downloads/重庆发展特殊化妆品可行性报告_政府汇报版.docx`
- local-folder iframe `fileUrl` 指向 `/api/local-folder/files/open?...`,未出现 `/api/media/sign` local 404。
- 证据:`tmp/codex-office-view-edit-plugin-2026-05-21/result.json`,截图 `01-office-view-mode.png` / `02-office-edit-mode.png`