Round 6 bug fixes (pre-release)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe
2026-03-04 21:23:34 +01:00
co-authored by Claude Opus 4.6
parent 1d0ee31001
commit 0ca359e509
5 changed files with 47 additions and 10 deletions
+2 -2
View File
@@ -650,7 +650,7 @@ class MegaDebridClient {
await sleepWithSignal(retryDelay(attempt), signal);
}
}
throw new Error(lastError || "Mega-Web Unrestrict fehlgeschlagen");
throw new Error(String(lastError || "Mega-Web Unrestrict fehlgeschlagen").replace(/^Error:\s*/i, ""));
}
}
@@ -954,7 +954,7 @@ class AllDebridClient {
}
}
throw new Error(lastError || "AllDebrid Unrestrict fehlgeschlagen");
throw new Error(String(lastError || "AllDebrid Unrestrict fehlgeschlagen").replace(/^Error:\s*/i, ""));
}
}
+16 -5
View File
@@ -1102,16 +1102,21 @@ export class DownloadManager extends EventEmitter {
active.abortController.abort("cancel");
}
const pkg = this.session.packages[item.packageId];
let removedByPackageCleanup = false;
if (pkg) {
pkg.itemIds = pkg.itemIds.filter((id) => id !== itemId);
if (pkg.itemIds.length === 0) {
this.removePackageFromSession(item.packageId, [itemId]);
removedByPackageCleanup = true;
} else {
pkg.updatedAt = nowMs();
}
}
delete this.session.items[itemId];
this.itemCount = Math.max(0, this.itemCount - 1);
// removePackageFromSession already deletes the item and decrements itemCount
if (!removedByPackageCleanup) {
delete this.session.items[itemId];
this.itemCount = Math.max(0, this.itemCount - 1);
}
this.retryAfterByItem.delete(itemId);
this.retryStateByItem.delete(itemId);
this.dropItemContribution(itemId);
@@ -1268,6 +1273,7 @@ export class DownloadManager extends EventEmitter {
this.packagePostProcessTasks.clear();
this.packagePostProcessAbortControllers.clear();
this.hybridExtractRequeue.clear();
this.providerFailures.clear();
this.packagePostProcessQueue = Promise.resolve();
this.packagePostProcessActive = 0;
for (const waiter of this.packagePostProcessWaiters) { waiter.resolve(); }
@@ -1885,7 +1891,7 @@ export class DownloadManager extends EventEmitter {
}
for (const entry of entries) {
if (entry.isFile()) {
if (entry.isFile() && !isIgnorableEmptyDirFileName(entry.name)) {
return true;
}
if (entry.isDirectory()) {
@@ -2739,6 +2745,7 @@ export class DownloadManager extends EventEmitter {
item.updatedAt = nowMs();
this.retryAfterByItem.delete(itemId);
this.retryStateByItem.delete(itemId);
this.releaseTargetPath(itemId);
this.recordRunOutcome(itemId, "cancelled");
affectedPackageIds.add(item.packageId);
}
@@ -2746,15 +2753,16 @@ export class DownloadManager extends EventEmitter {
const pkg = this.session.packages[pkgId];
if (pkg) this.refreshPackageStatus(pkg);
}
// Trigger extraction if all items are now in a terminal state and some completed
// Trigger extraction if all items are now in a terminal state and some completed (no failures)
if (this.settings.autoExtract) {
for (const pkgId of affectedPackageIds) {
const pkg = this.session.packages[pkgId];
if (!pkg || pkg.cancelled || this.packagePostProcessTasks.has(pkgId)) continue;
const pkgItems = pkg.itemIds.map((id) => this.session.items[id]).filter(Boolean) as DownloadItem[];
const hasPending = pkgItems.some((i) => i.status !== "completed" && i.status !== "failed" && i.status !== "cancelled");
const hasFailed = pkgItems.some((i) => i.status === "failed");
const hasUnextracted = pkgItems.some((i) => i.status === "completed" && !isExtractedLabel(i.fullStatus || ""));
if (!hasPending && hasUnextracted) {
if (!hasPending && !hasFailed && hasUnextracted) {
for (const it of pkgItems) {
if (it.status === "completed" && !isExtractedLabel(it.fullStatus || "")) {
it.fullStatus = "Entpacken - Ausstehend";
@@ -2935,6 +2943,9 @@ export class DownloadManager extends EventEmitter {
this.runCompletedPackages.clear();
this.retryAfterByItem.clear();
this.retryStateByItem.clear();
this.itemContributedBytes.clear();
this.reservedTargetPaths.clear();
this.claimedTargetPathByItem.clear();
this.session.running = true;
this.session.paused = false;
this.session.runStartedAt = nowMs();
+2 -1
View File
@@ -1597,7 +1597,8 @@ async function extractZipArchive(archivePath: string, targetDir: string, conflic
const limitMb = Math.ceil(memoryLimitBytes / (1024 * 1024));
throw new Error(`ZIP-Eintrag zu groß für internen Entpacker (${entryMb} MB > ${limitMb} MB)`);
}
if (data.length > Math.max(uncompressedSize, compressedSize) * 20) {
const maxDeclaredSize = Math.max(uncompressedSize, compressedSize);
if (maxDeclaredSize > 0 && data.length > maxDeclaredSize * 20) {
throw new Error(`ZIP-Eintrag verdächtig groß nach Entpacken (${entry.entryName})`);
}
await fs.promises.writeFile(outputPath, data);
+1 -1
View File
@@ -196,6 +196,6 @@ export class RealDebridClient {
}
}
throw new Error(lastError || "Unrestrict fehlgeschlagen");
throw new Error(String(lastError || "Unrestrict fehlgeschlagen").replace(/^Error:\s*/i, ""));
}
}