style(adapters): throw instead of returning never in assertSafeToDeleteData
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
fa9221086b
commit
ef3998767c
1 file changed
+2
-2
@@ -42,12 +42,12 @@ export function assertSafeToDeleteData(check: SafeDeleteCheck, instanceId = ""):
|
||||
};
|
||||
if (check.importVerified !== true) fail("尚未验证入库");
|
||||
const content = normalize(check.contentPath);
|
||||
if (!content) return fail("contentPath 不是绝对路径");
|
||||
if (!content) throw fail("contentPath 不是绝对路径");
|
||||
if (isRootLike(content)) fail("contentPath 是根目录");
|
||||
if (check.libraryRoots.length === 0) fail("未提供媒体库根,无法确认不在库内");
|
||||
for (const raw of check.libraryRoots) {
|
||||
const root = normalize(raw);
|
||||
if (!root) return fail(`媒体库根不是绝对路径: ${raw}`);
|
||||
if (!root) throw fail(`媒体库根不是绝对路径: ${raw}`);
|
||||
if (within(content, root)) fail(`contentPath 位于媒体库 ${root} 内`);
|
||||
if (within(root, content)) fail(`contentPath 包含媒体库 ${root}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user