#23593: UnicodeDecodeError when handling uncaught exception with UTF-8 in URL
------------------------------------+--------------------------------------
     Reporter:  edevil              |                    Owner:  nobody
         Type:  Bug                 |                   Status:  new
    Component:  HTTP handling       |                  Version:  master
     Severity:  Normal              |               Resolution:
     Keywords:  UnicodeDecodeError  |             Triage Stage:  Unreviewed
    Has patch:  0                   |      Needs documentation:  0
  Needs tests:  0                   |  Patch needs improvement:  0
Easy pickings:  0                   |                    UI/UX:  0
------------------------------------+--------------------------------------

Comment (by edevil):

 As I mentioned, this happens when DEBUG=False, an exception is thrown
 while servicing the request, and there is UTF-8 in the URL. It seems you
 only reproduced the "UTF-8 in the URL part"...

 You can put the following url pattern:
 {{{
 urlpatterns = patterns('',
     url(r'^(*)$', 'utils.cross_domain.cross_domain_xml'),
 )
 }}}

 and this will cause an exception. Then self.format(record) will end up:
 (notice it's unicode)
 {{{
 u'Internal Server Error: /[SC] TIC 7\xbaC\nTraceback (most recent call
 last):\n  File "/Users/andre/work/penv/discosite/lib/python2.7/site-
 packages/django/core/handlers/base.py", line 87, in get_response\n
 response = middleware_method(request)\n  File
 "/Users/andre/work/penv/discosite/lib/python2.7/site-
 packages/django/middleware/common.py", line 72, in process_request\n    if
 (not urlresolvers.is_valid_path(request.path_info, urlconf) and\n  File
 "/Users/andre/work/penv/discosite/lib/python2.7/site-
 packages/django/core/urlresolvers.py", line 614, in is_valid_path\n
 resolve(path, urlconf)\n  File
 "/Users/andre/work/penv/discosite/lib/python2.7/site-
 packages/django/core/urlresolvers.py", line 489, in resolve\n    return
 get_resolver(urlconf).resolve(path)\n  File
 "/Users/andre/work/penv/discosite/lib/python2.7/site-
 packages/django/core/urlresolvers.py", line 340, in resolve\n    sub_match
 = pattern.resolve(new_path)\n  File
 "/Users/andre/work/penv/discosite/lib/python2.7/site-
 packages/django/core/urlresolvers.py", line 211, in resolve\n    match =
 self.regex.search(path)\n  File
 "/Users/andre/work/penv/discosite/lib/python2.7/site-
 packages/django/core/urlresolvers.py", line 179, in regex\n    (regex,
 six.text_type(e)))\nImproperlyConfigured: "^(*)$" is not a valid regular
 expression: nothing to repeat'
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23593#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.8ed70091cc6a06682e79dfffb952e93d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to