Skip to content

Commit 2751372

Browse files
committed
Requested changes
1 parent 0388fc9 commit 2751372

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

python/pythonmonkey/builtin_modules/base64.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88

99

1010
def atob(b64):
11-
# Workaround for pythons 'Incorrect padding' error when base64 decoding, see:
12-
# https://stackoverflow.com/questions/2941995/python-ignore-incorrect-padding-error-when-base64-decoding
13-
append = b"==" if isinstance(b64, bytes) else "=="
14-
return str(base64.standard_b64decode(b64 + append), 'latin1')
11+
padding = '=' * (4 - (len(b64) & 3))
12+
return str(base64.standard_b64decode(b64 + padding), 'latin1')
1513

1614

1715
def btoa(data):

0 commit comments

Comments
 (0)