阻止本地素材登记结果错位回填

资源导入返回数量与请求路径不一致时立即中止位置映射。
This commit is contained in:
2026-09-11 18:58:35 +08:00
parent bf2ffd2bf9
commit 73fb89a8f4
@@ -1086,6 +1086,11 @@ export function useUiEditorSession(
'import_local_project_image_assets',
{ projectPath, relativePaths },
);
if (imported.assets.length !== relativePaths.length) {
throw new Error(
`本地资源登记结果数量不匹配:请求 ${relativePaths.length} 个,返回 ${imported.assets.length}`,
);
}
for (const [assetIndex, asset] of imported.assets.entries()) {
const normalizedAsset = {
id: asset.id,