2581: diff can be viewed but cannot be downloaded (500)

pphea*****@gmai***** (Google Code) (Is this you? Claim this profile.)
david
david
Nov. 25, 2012
What version are you running?
1.6.5

What's the URL of the page containing the problem?
/r/{x}/diff/raw/

What steps will reproduce the problem?
1.upload some svn patch that contains Chinese(encoded) comments
2.try to download it, get 500, though view diff works

What is the expected output? What do you see instead?


What operating system are you using? What browser?
Server: ubuntu Client: windows-Chrome

Please provide any additional information below.
logging of the error:
2012-04-26 13:58:01,933 - ERROR - Exception thrown for user admin at http://xxx/r/{x}/diff/raw/

'ascii' codec can't encode characters in position 29-35: ordinal not in range(128), HTTP response headers must be in US-ASCII format
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Django-1.3.1-py2.7.egg/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/accounts/decorators.py", line 21, in _check
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/reviews/views.py", line 776, in raw_diff
    resp['Content-Disposition'] = 'inline; filename=%s' % filename
  File "/usr/local/lib/python2.7/dist-packages/Django-1.3.1-py2.7.egg/django/http/__init__.py", line 533, in __setitem__
    header, value = self._convert_to_ascii(header, value)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.3.1-py2.7.egg/django/http/__init__.py", line 522, in _convert_to_ascii
    value = value.encode('us-ascii')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 29-35: ordinal not in range(128), HTTP response headers must be in US-ASCII format
2012-04-26 13:58:01,933 - ERROR - Internal Server Error: /r/{x}/diff/raw/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Django-1.3.1-py2.7.egg/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/accounts/decorators.py", line 21, in _check
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.5-py2.7.egg/reviewboard/reviews/views.py", line 776, in raw_diff
    resp['Content-Disposition'] = 'inline; filename=%s' % filename
  File "/usr/local/lib/python2.7/dist-packages/Django-1.3.1-py2.7.egg/django/http/__init__.py", line 533, in __setitem__
    header, value = self._convert_to_ascii(header, value)
  File "/usr/local/lib/python2.7/dist-packages/Django-1.3.1-py2.7.egg/django/http/__init__.py", line 522, in _convert_to_ascii
    value = value.encode('us-ascii')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 29-35: ordinal not in range(128), HTTP response headers must be in US-ASCII format
david
#1 david
Probably this is actually about diff filenames with unicode characters.
david
#2 david
  • +PendingReview
  • +david
david
#3 david
Fixed in release-1.7.x (d910f95)
  • -PendingReview
    +Fixed