changeset 8190:08af13a090e0

py3: update ssh for base64.b64decode raising binascii.Error instead of TypeError A command like: python -c 'import base64; base64.b64decode("QQ")' would fail in Python2 with: TypeError: Incorrect padding but in python3: binascii.Error: Incorrect padding
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 25 Jan 2020 19:53:56 +0100
parents 02c119ae72e1
children eb6ffd819900
files kallithea/lib/ssh.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/ssh.py	Wed Dec 25 17:01:19 2019 +0100
+++ b/kallithea/lib/ssh.py	Sat Jan 25 19:53:56 2020 +0100
@@ -87,7 +87,7 @@
 
     try:
         key_bytes = base64.b64decode(keyvalue)
-    except TypeError:
+    except base64.binascii.Error:
         raise SshKeyParseError(_("Incorrect SSH key - failed to decode base64 part %r") % keyvalue)
 
     if not key_bytes.startswith(b'\x00\x00\x00%c%s\x00' % (len(keytype), ascii_bytes(keytype))):