feat(restore): 恢复到指定目录(文件类型本机恢复 + 确认弹窗输入)#86
Merged
Conversation
Owner
Author
|
本 PR 让恢复目标路径来自请求体(用户可控),流入 不采用
|
This was referenced May 27, 2026
d311ae7 to
9ab4dd4
Compare
恢复此前只能覆盖原始源路径。新增「恢复到指定目录」:把文件备份还原到任意目录,
用于测试恢复、迁移、并排恢复而不覆盖现网数据。
- backup.TaskSpec +RestoreTargetPath;FileRunner.Restore 非空时把归档解压到该目录。
- model.RestoreRecord +TargetPath(持久化/审计)。
- RestoreService.Start 增加 targetPath 参数与校验:仅文件类型、需绝对路径、
远程节点暂不支持(清晰报错);executeLocally 透传到 spec。
- 恢复触发端点接受可选请求体 {targetPath}(无 body 时恢复到原始路径)。
- 测试:恢复到指定目录后文件落在该目录;相对路径被拒。
文件类型 + 本机恢复时,恢复确认弹窗新增「恢复到指定目录」输入(可选、绝对路径、 留空=原位置),并实时反映在「恢复目标」摘要中;经 startRestoreFromBackup 透传 targetPath。
9ab4dd4 to
b0314c3
Compare
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.
背景(丰富核心恢复能力)
恢复此前只能覆盖原始源路径。新增「恢复到指定目录」——把文件备份还原到任意目录,用于测试恢复 / 迁移 / 并排恢复而不覆盖现网数据。这是备份产品的核心恢复灵活性。
后端
backup.TaskSpec+RestoreTargetPath;FileRunner.Restore非空时把归档解压到该目录(沿用原有目录穿越防护)。model.RestoreRecord+TargetPath(持久化/审计)。RestoreService.Start(…, targetPath, …)校验:仅文件类型、需绝对路径、远程节点暂不支持(清晰报错);executeLocally透传到 spec。{targetPath}(无 body 时恢复到原始路径,向后兼容)。前端
测试
go test ./...全绿;前端tsc + vite build通过。