fix(import): name merged parts after their folder and clean up empty ones

This commit is contained in:
Steppenstreuner
2026-08-28 20:49:32 +02:00
parent 36263d66fb
commit a816dcb27a
3 changed files with 49 additions and 4 deletions
+5 -1
View File
@@ -816,7 +816,11 @@ $("#import-merge").addEventListener("click", () => {
toast("Die Einträge liegen in verschiedenen Ordnern", true);
return;
}
const name = commonPrefix(chosen.map((it) => it.name)) || chosen[0].name;
// parts may share no prefix at all ("A - Sphinx", "B - Volk"): then the
// folder holding them carries the real title ("100 - Toteninsel")
const parentName = (chosen[0].rel_dir || "").split("/").filter(Boolean).pop();
const name =
commonPrefix(chosen.map((it) => it.name)) || parentName || chosen[0].name;
const merged = {
path: chosen[0].path.slice(0, chosen[0].path.length - chosen[0].name.length - 1) || chosen[0].path,
name,