#335 Error adding SSH pubkey with non-ASCII
Closed: Fixed Opened by scop.

I tried to add my SSH pubkey and it failed with an internal server error. The pubkey had a comment with some UTF-8 content with it, like:

ssh-rsa [...] Ville Skyttä scop@fedoraproject.org

After modifying the pubkey comment to this, setting it succeeded:

ssh-rsa [...] scop@fedoraproject.org


On Thu, Aug 13, 2015 at 06:07:51PM +0000, pagure@pagure.io wrote:

I tried to add my SSH pubkey and it failed with an internal server error. The pubkey had a comment with some UTF-8 content with it, like:

ssh-rsa [...] Ville Skytt� scop@fedoraproject.org

After modifying the pubkey comment to this, setting it succeeded:

ssh-rsa [...] scop@fedoraproject.org

I received the notification for this error, here is the stack-trace if someone
wants to look into it:

Traceback (most recent call last):

File "/usr/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/usr/lib/python2.7/site-packages/pagure/init.py", line 257, in decorated_function
return function(args, *kwargs)
File "/usr/lib/python2.7/site-packages/pagure/ui/app.py", line 294, in user_settings
generate_gitolite_key(user.user, ssh_key)
File "/usr/lib/python2.7/site-packages/pagure/init.py", line 201, in generate_gitolite_key
stream.write(key + '\n')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 392: ordinal not in range(128)

Thanks for the report!

Implemented in https://pagure.io/pagure/pull-request/365

Commit b7e5e69e fixes this issue

Metadata