copy(server): 文件管理错误文案按 human-copy 重写
「根」统一叫登记目录;去掉「请…」;H&R 拦截不再露待处理事项 ID,改给下一步动作。 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
50aa02cfc5
commit
12a8caa463
13 files changed
+57
-53
No files matched your search
@@ -25,7 +25,8 @@ export async function mkdirIn(
|
||||
body: FilesMkdirRequest,
|
||||
): Promise<FilesMkdirResult> {
|
||||
const r = await resolveIn(d, body.root, body.path);
|
||||
if (!(await isWritableTarget(r.def, r.rootReal))) throw new FilesError("not_writable", `根 ${r.def.name} 不可写`);
|
||||
if (!(await isWritableTarget(r.def, r.rootReal)))
|
||||
throw new FilesError("not_writable", `登记目录「${r.def.name}」不可写`);
|
||||
if (!r.lst?.isDirectory() || r.isSymlink) throw new FilesError("bad_request", `不是目录:${r.rel || "/"}`);
|
||||
assertCleanName(body.name);
|
||||
await recheck(r.abs, r.rootReal);
|
||||
@@ -59,8 +60,8 @@ export async function renameEntry(
|
||||
body: FilesRenameRequest,
|
||||
): Promise<FilesRenameResult> {
|
||||
const r = await resolveIn(d, body.root, body.path);
|
||||
if (r.rel === "") throw new FilesError("bad_request", "根目录不能重命名");
|
||||
if (!r.def.modifiable) throw new FilesError("not_writable", `根 ${r.def.name} 只读,不能重命名`);
|
||||
if (r.rel === "") throw new FilesError("bad_request", "登记目录本身不能重命名");
|
||||
if (!r.def.modifiable) throw new FilesError("not_writable", `登记目录「${r.def.name}」只读,不能重命名`);
|
||||
assertCleanName(body.newName);
|
||||
const oldName = basename(r.abs);
|
||||
if (body.newName === oldName) throw new FilesError("bad_request", "新名称与原名称相同");
|
||||
@@ -71,7 +72,7 @@ export async function renameEntry(
|
||||
if (hits.length > 0)
|
||||
throw new FilesError(
|
||||
"download_active",
|
||||
`该路径属于下载任务 ${hits.map((h) => h.taskId).join(", ")},重命名会让下载器找不到文件。先整理再改`,
|
||||
`该路径属于下载任务 ${hits.map((h) => h.taskId).join(", ")},重命名会让下载器找不到文件。整理后再改名`,
|
||||
);
|
||||
|
||||
const dirAbs = dirname(r.abs);
|
||||
|
||||
Reference in new issue
Block a user