From a0c58aad2c718ed58a13f06d954f058079e61752 Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Sun, 1 Mar 2026 02:03:37 +0100 Subject: [PATCH] Release v1.4.36 with tolerant DLC padding - Local DLC decryption no longer throws on invalid PKCS7 padding - Instead tries to parse the decrypted data as-is (Node.js base64 decoder is lenient with trailing garbage bytes) - This fixes large DLCs that previously failed locally and then hit dcrypt.it's 413 size limit on both endpoints - Empty decryption result returns [] instead of throwing Co-Authored-By: Claude Opus 4.6 --- package.json | 2 +- src/main/container.ts | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 7fc1eac..bccb8cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "real-debrid-downloader", - "version": "1.4.35", + "version": "1.4.36", "description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)", "main": "build/main/main/main.js", "author": "Sucukdeluxe", diff --git a/src/main/container.ts b/src/main/container.ts index 6549ee5..2027134 100644 --- a/src/main/container.ts +++ b/src/main/container.ts @@ -145,18 +145,21 @@ async function decryptDlcLocal(filePath: string): Promise let decrypted = Buffer.concat([decipher.update(encrypted), decipher.final()]); if (decrypted.length === 0) { - throw new Error("DLC-Entschlüsselung lieferte keine Daten"); + return []; } const pad = decrypted[decrypted.length - 1]; - if (pad <= 0 || pad > 16 || pad > decrypted.length) { - throw new Error("Ungültiges DLC-Padding"); - } - for (let index = 1; index <= pad; index += 1) { - if (decrypted[decrypted.length - index] !== pad) { - throw new Error("Ungültiges DLC-Padding"); + if (pad > 0 && pad <= 16 && pad <= decrypted.length) { + let validPad = true; + for (let index = 1; index <= pad; index += 1) { + if (decrypted[decrypted.length - index] !== pad) { + validPad = false; + break; + } + } + if (validPad) { + decrypted = decrypted.subarray(0, decrypted.length - pad); } } - decrypted = decrypted.subarray(0, decrypted.length - pad); const xmlData = Buffer.from(decrypted.toString("utf8"), "base64").toString("utf8"); return parsePackagesFromDlcXml(xmlData);