We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f1ecd77 commit ec69312Copy full SHA for ec69312
itsdangerous.py
@@ -207,7 +207,12 @@ def base64_decode(string):
207
The result is also a bytestring.
208
"""
209
string = want_bytes(string, encoding='ascii', errors='ignore')
210
- return base64.urlsafe_b64decode(string + b'=' * (-len(string) % 4))
+ string += b'=' * (-len(string) % 4)
211
+
212
+ try:
213
+ return base64.urlsafe_b64decode(string)
214
+ except (TypeError, ValueError):
215
+ raise BadData('Invalid base64-encoded data')
216
217
218
_int64_struct = struct.Struct('>Q')
0 commit comments