Extend hybrid companion stem matching to all archive types

The stem extraction regex for matching companion metadata files (.sfv,
.nfo) to their archives only handled RAR patterns. Now also covers
ZIP, 7z, tar, generic splits, and recovery volumes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-04-04 21:28:06 +02:00
parent ee69dcf4cc
commit 49efebd001

View File

@ -10116,8 +10116,12 @@ export class DownloadManager extends EventEmitter {
for (const part of parts) {
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, "");
// Collect archive base stems (strip all archive extensions) to find companion files
const stem = partName
.replace(/\.part\d+\.rar$/i, "")
.replace(/\.(rar|r\d{2,3}|zip|z\d{2,3}|7z|tar|gz|bz2|xz|tgz|tbz2|txz|rev)$/i, "")
.replace(/\.(zip|7z)\.\d{3}$/i, "")
.replace(/\.\d{3}$/i, "");
if (stem && stem !== partName) archiveStems.add(stem);
}
hybridFileNames.add(path.basename(archiveKey).toLowerCase());