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 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-03-01 02:03:37 +01:00
parent 48c89713ba
commit a0c58aad2c
2 changed files with 12 additions and 9 deletions

View File

@ -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",

View File

@ -145,18 +145,21 @@ async function decryptDlcLocal(filePath: string): Promise<ParsedPackageInput[]>
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");
}
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) {
throw new Error("Ungültiges DLC-Padding");
validPad = false;
break;
}
}
if (validPad) {
decrypted = decrypted.subarray(0, decrypted.length - pad);
}
}
const xmlData = Buffer.from(decrypted.toString("utf8"), "base64").toString("utf8");
return parsePackagesFromDlcXml(xmlData);