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 <noreply@anthropic.com>
This commit is contained in:
parent
33658503a8
commit
dfc5d73105
@ -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));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user