fix: reject native source renames before management writes

This commit is contained in:
阿白叔 committed 2026-11-17 01:22:57 +08:00
1 parent 36ff964230
commit d40fa3a750
7 files changed
+102 -20

No files matched your search

@@ -156,10 +156,13 @@ class ManagementDialog(QDialog):
try:
if not requests:
raise ValueError('请先选择来源工程。')
if hasattr(self.adapter, 'validate_source'):
for request in requests:
self.adapter.validate_source(request)
# Per-item input errors belong in batch results, so valid rows still run.
if len({(r.partition.casefold(), r.name.casefold()) for r in requests}) != len(requests):
raise ValueError('批次包含重复目标名称。')
except ValueError as error:
except (OSError, ValueError) as error:
self.status_label.setText(str(error)); return
preview = '\n'.join(f'{r.partition} / {r.name}' + (f' ← {r.source}' if r.source else '') for r in requests)
description = ('同名更新会原生移除并重新导入;导入失败需要使用手动备份恢复。' if self.operation == 'update'