Mark companion metadata files (.sfv) as extracted during hybrid extraction

SFV files belong to the same archive set as the RAR parts but were not
included in hybridFileNames, causing them to stay stuck on "Entpacken -
Ausstehend" after the RAR parts were successfully extracted. This blocked
package completion in hybrid extraction mode.

Fix: collect archive base stems from extracted parts and match companion
metadata files (.sfv, .nfo, etc.) by stem, adding them to hybridFileNames
so they get marked as "Entpackt" together with their archive parts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-04-04 20:21:16 +02:00
parent 68bfeb574f
commit 021401e3b6

View File

@ -10110,13 +10110,30 @@ export class DownloadManager extends EventEmitter {
.filter((entry) => entry.isFile()) .filter((entry) => entry.isFile())
.map((entry) => entry.name); .map((entry) => entry.name);
} catch { /* ignore */ } } catch { /* ignore */ }
const archiveStems = new Set<string>();
for (const archiveKey of readyArchives) { for (const archiveKey of readyArchives) {
const parts = collectArchiveCleanupTargets(archiveKey, dirFiles); const parts = collectArchiveCleanupTargets(archiveKey, dirFiles);
for (const part of parts) { for (const part of parts) {
hybridFileNames.add(path.basename(part).toLowerCase()); const partName = path.basename(part).toLowerCase();
hybridFileNames.add(partName);
// Collect archive base stems (without .partNN.rar / .rar / .rNN) to find companion files
const stem = partName.replace(/\.part\d+\.rar$|\.r\d{2,3}$|\.rar$/i, "");
if (stem && stem !== partName) archiveStems.add(stem);
} }
hybridFileNames.add(path.basename(archiveKey).toLowerCase()); hybridFileNames.add(path.basename(archiveKey).toLowerCase());
} }
// Include companion metadata files (.sfv, .nfo, etc.) that belong to the same archive set.
// These files share the same basename stem as the archive parts.
if (dirFiles && archiveStems.size > 0) {
for (const fileName of dirFiles) {
const lower = fileName.toLowerCase();
if (!KNOWN_SMALL_FILE_RE.test(lower)) continue;
const companionStem = lower.replace(/\.[^.]+$/, "");
if (archiveStems.has(companionStem)) {
hybridFileNames.add(lower);
}
}
}
const isHybridItem = (item: DownloadItem): boolean => { const isHybridItem = (item: DownloadItem): boolean => {
if (item.targetPath && hybridFileNames.has(path.basename(item.targetPath).toLowerCase())) { if (item.targetPath && hybridFileNames.has(path.basename(item.targetPath).toLowerCase())) {
return true; return true;