From dfc5d731056bdad317db39a637b3c730c77445d6 Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Sat, 7 Mar 2026 00:03:31 +0100 Subject: [PATCH] Fix disk-fallback extraction triggering with incomplete archive parts When a pending item has neither targetPath nor fileName (e.g. after a reset before re-unrestrict), it is invisible to pendingItemStatus and the disk-fallback could incorrectly start extraction with a partial file. Add a guard that skips disk-fallback for any archive set if the package contains such an untracked pending item. Co-Authored-By: Claude Sonnet 4.6 --- src/main/download-manager.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/download-manager.ts b/src/main/download-manager.ts index fb1b197..b58ba15 100644 --- a/src/main/download-manager.ts +++ b/src/main/download-manager.ts @@ -6747,6 +6747,19 @@ export class DownloadManager extends EventEmitter { if (anyActivelyProcessing) { continue; } + // Safety: if any pending item in the package has neither targetPath nor fileName, + // we cannot map it to a file on disk. It could correspond to any missingPart + // (e.g. after a reset before re-unrestrict), so skip disk-fallback for this archive. + const hasUntrackedPendingItem = pkg.itemIds.some((itemId) => { + const pendingItem = this.session.items[itemId]; + return pendingItem + && !isFinishedStatus(pendingItem.status) + && !pendingItem.targetPath + && !pendingItem.fileName; + }); + if (hasUntrackedPendingItem) { + continue; + } logger.info(`Hybrid-Extract Disk-Fallback: ${path.basename(candidate)} (${missingParts.length} Part(s) auf Disk ohne completed-Status)`); ready.add(pathKey(candidate)); }