Bug 867647 - POST to sync repository API with UTF8 username causes traceback
Summary: POST to sync repository API with UTF8 username causes traceback
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Pulp
Classification: Retired
Component: API/integration
Version: 1.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Jason Connor
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks: 835586
TreeView+ depends on / blocked
 
Reported: 2012-10-17 23:09 UTC by Mike McCune
Modified: 2014-03-31 01:40 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-10-24 15:55:32 UTC
Embargoed:


Attachments (Terms of Use)
call the script with a username each time (534 bytes, application/octet-stream)
2012-10-17 23:10 UTC, Mike McCune
no flags Details
replacement that sets the content-type header (535 bytes, application/octet-stream)
2012-10-17 23:11 UTC, Mike McCune
no flags Details

Description Mike McCune 2012-10-17 23:09:04 UTC
If you have a user in pulp with UTF8 characters in the username you can't POST calls to:

 https://localhost/pulp/api/repositories/$REPO/sync/

without getting the dreaded:

 File "/usr/lib/python2.6/site-packages/pulp/server/db/model/persistence.py", line 55, in _process_value
    value = value.decode('utf-8')
  File "/usr/lib64/python2.6/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 271: invalid continuation byte


error ...

See attached bash script that reproduces the error with the following steps.  call the script with a new username each time, you can try with ascii which works fine or latin1 or utf8 chars.  Apache doesn't seem to like headers with latin chars ..

ASCII works fine:


$ ./utf8-pain.bash ascii1
Successfully created repository [ kpJfjWgFow ]

Successfully created user [ ascii1 ] with name [ None ]

[ ascii1 ] added to role [ super-users ]

{"scheduled_time": "2012-10-17T23:05:59Z", "exception": null, "traceback": null, "job_id": null, "class_name": null, "start_time": null, "args": ["kpJfjWgFow"], "method_name": "_sync", "finish_time": null, "state": "waiting", "result": null, "scheduler": "immediate", "progress": null, "id": "3713ddd7-18af-11e2-b28c-1803734d16c4"}

$ tail -f /var/log/pulp/pulp.log in another window and look for the above exception


non-ASCII will cause the exception:

$ ./utf8-pain.bash 7Mané
....
$ tail  /var/log/pulp/pulp.log
...
 File "/usr/lib64/python2.6/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 271: invalid continuation byte

Comment 1 Mike McCune 2012-10-17 23:10:11 UTC
Created attachment 629115 [details]
call the script with a username each time

$ ./utf8-pain.bash some-new-user

$ ./utf8-pain.bash some-non-ascii-7Mané

Comment 2 Mike McCune 2012-10-17 23:11:31 UTC
Created attachment 629116 [details]
replacement that sets the content-type header

Comment 3 Mike McCune 2012-10-22 19:25:52 UTC
https://github.com/pulp/pulp/pull/111

Comment 4 Jason Connor 2012-10-24 15:55:32 UTC
Pulp will only support ASCII usernames


Note You need to log in before you can comment on or make changes to this bug.