Repository navigation
feat(web): implement space export and import flow - #325
Merged
todosdev[bot] merged 3 commits intoNov 28, 2026
Merged
Conversation
add client-side space export and import assembly engines using fflate, featuring zero-backend preflight validation, concurrency limits, IndexedDB checkpoint resumption, two-pass reference remapping, and export/import dialog components across space management views. Checkpoint: jqk50Cjhkmos1sxcgzaMN
…w feedbacks - Fix path traversal check in preflight to inspect path segments avoiding false positives on filenames containing '..' - Strip dynamic embed height reporting script on export to preserve verbatim bytes - Add full end-to-end roundtrip test from export to import with skeleton and content remapping verification - Validate file key shape strictly with UPLOAD_KEY_RE and EMBED_KEY_RE - Display targetSpaceId and missingFilesCount in ImportSpaceDialog report view - Preserve detail.createdAt in manifest pages during export Checkpoint: saOPdKDihCZTsXBwKAFYw
…0-737d-ab78-7006a68ef229
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
web/src/lib/space-archive/):export.ts: 并发度 ≤4 且支持退避重试的取材打包流;剥离会话端点动态追加的 embed 高度上报脚本,还原逐字原始 HTML;记录真实createdAt并生成标准manifest.json;优先通过原生 File System Access 落盘,整包 Blob 兜底并提示 >200MB 大包。import.ts: 覆盖 format/version/白名单目录/路径段级防穿越/无环拓扑的零写入预检;新建独立承接空间、分类上传附件(容忍 413 并记入失败清单)、树状骨架构建及两遍重映射正文填入。checkpoint.ts: 基于 IndexedDB 的任务检查点持久化管理与 SHA-256 计算。content-parser.ts: TipTap JSON 附件提取、UPLOAD_KEY_RE/EMBED_KEY_RE正则校验、结构化引用与站内链接重映射、Markdown 相对路径改写。path.ts&scheduler.ts: 树层级路径派生、同级序号前缀、相对 POSIX 路径计算与限流调度器。types.ts: 导出包 Manifest 契约、预检、检查点及报告数据模型。web/src/components/,web/src/locales/):ExportSpaceDialog.tsx: 导出进度展示、预估请求数/体积与取消能力。ImportSpaceDialog.tsx: 预检结果先行、一句话失败处置提示确认、三阶段进度条、检查点续跑分支、新空间 ID 与缺失附件报告展示。SpaceSwitcher.tsx,SpaceSettingsPage.tsx,SpacesTab.tsx,CreateSpaceDialog.tsx: 挂载操作入口。zh.json&en.json: 补齐导出与导入的中英文国际化文案。web/package.json,pnpm-lock.yaml):fflate库。Testing
web/src/lib/space-archive/export-import.test.ts: 16 个核心引擎用例,包括路径工具、Key 正则校验、脚本剥离、坏包预检、文件名含..的合法标题放行、检查点续跑、以及三级嵌套树/站内互链/四类附件/合并表头表格/TS 代码块语义保真的端到端往返实测。web/src/components/ExportSpaceDialog.test.tsx: 导出弹窗交互与权限测试。web/src/components/ImportSpaceDialog.test.tsx: 导入弹窗预检、确认、执行与报告交互测试。pnpm test)。pnpm typecheck)。pnpm format:check && pnpm lint)。pnpm --filter web build)。