fix laying out non-{rsa,dss} keys

feature/enhanced-ticket-view
vilmibm 2018-07-08 19:28:29 -07:00
parent a908079ba9
commit 7fc039559e
1 changed files with 3 additions and 1 deletions

View File

@ -145,7 +145,9 @@ class Townie(User):
file"""
content = KEYFILE_HEADER
for pubkey in self.pubkey_set.all():
if pubkey.key.startswith('ssh-'):
prefix = pubkey.key.split(' ')
prefix = prefix[0] if len(prefix) > 0 else None
if prefix in [p[0] for p in SSH_TYPE_CHOICES]:
content += '\n{}'.format(pubkey.key)
else:
content += '\n{} {}'.format(pubkey.key_type, pubkey.key)