From 2ad6024ad8c3b4d2699d6bfd7a444a1014734889 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 1 Oct 2020 11:21:32 -0700 Subject: [PATCH] Slightly jank fix to deal with extra data after json dict. Even though the dict decodes just fine, I'm having some cases where there is additional data after it. The data looks like random junk bytes. --- src/mega/crypto.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mega/crypto.py b/src/mega/crypto.py index 03e9954..d539244 100644 --- a/src/mega/crypto.py +++ b/src/mega/crypto.py @@ -86,6 +86,8 @@ def decrypt_attr(attr, key): attr = aes_cbc_decrypt(attr, a32_to_str(key)) attr = makestring(attr) attr = attr.rstrip('\0') + if '"}\0' in attr: + attr = attr.split('"}\0')[0] + '"}' return json.loads(attr[4:]) if attr[:6] == 'MEGA{"' else False def a32_to_str(a):