From 5221eda1ad0fbfa26b01cf66354a5415141adf4a Mon Sep 17 00:00:00 2001 From: Gonzalo SR Date: Thu, 14 Feb 2013 13:02:11 +0100 Subject: Support for incorrectly padded Mega.co.nz keys Sometimes base64 Mega keys are incorrectly padded. Ugly hack to add padding characters as needed. --- module/plugins/hoster/MegaNz.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/MegaNz.py b/module/plugins/hoster/MegaNz.py index 1c48906ca..6644d372c 100644 --- a/module/plugins/hoster/MegaNz.py +++ b/module/plugins/hoster/MegaNz.py @@ -28,7 +28,8 @@ class MegaNz(Hoster): FILE_SUFFIX = ".crypted" def b64_decode(self, data): - return standard_b64decode(data.replace("-", "+").replace("_", "/")+ "=") + data = data.replace("-", "+").replace("_", "/") + return standard_b64decode(data + '=' * (-len(data) % 4)) def getCipherKey(self, key): """ Construct the cipher key from the given data """ -- cgit v1.2.3