Modify

Opened 11 years ago

Closed 9 years ago

Last modified 9 years ago

#11388 closed defect (fixed)

TypeError: decoding Unicode is not supported

Reported by: matheusslima@… Owned by: Jun Omae
Priority: normal Component: TracForgePlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

How to Reproduce

While doing a GET operation on /projects/analistas/browser/Baselines, Trac issued an internal error.

I'm trying to migrate some TRAC projects from a old 0.12dev-r7634 to a new 0.12.5 installation

Request parameters:

{}

User agent: `Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0`

System Information

TRAC 0.12.5

Enabled Plugins

TracForgePlugin

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 522, in
_dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 199, in
dispatch
    if handler.match_request(req):
  File "/usr/local/lib/python2.7/dist-
packages/TracForge-1.1-py2.7.egg/tracforge/admin/dispatch.py", line 117,
in match_request
    self._send_project(req, path_info)
  File "/usr/local/lib/python2.7/dist-
packages/TracForge-1.1-py2.7.egg/tracforge/admin/dispatch.py", line 196,
in _send_project
    req._response = dispatch_request(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 490, in
dispatch_request
    return _dispatch_request(req, env, env_error)
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 566, in
_dispatch_request
    send_internal_error(env, req, sys.exc_info())
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 645, in
send_internal_error
    description_en = get_description(lambda s, **kw: safefmt(s, kw))
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 640, in
get_description
    method=req.method, path_info=req.path_info,
  File "/usr/lib/python2.7/dist-packages/trac/web/api.py", line 250, in
path_info
    return unicode(path_info, 'utf-8')
TypeError: decoding Unicode is not supported

Attachments (0)

Change History (6)

comment:1 Changed 11 years ago by anonymous

comment:3 Changed 11 years ago by matheusslima@…

i have made the following changes on "/usr/lib/python2.7/dist-packages/trac/web/api.py" and now works:

    @property
    def path_info(self):
        """Path inside the application"""
        path_info = self.environ.get('PATH_INFO', '')
        try:
            return unicode(path_info, 'utf-8')
#        except UnicodeDecodeError:
#            raise HTTPNotFound(_("Invalid URL encoding (was %(path_info)r)",
#                                 path_info=path_info))
        except (TypeError, UnicodeDecodeError):
                return path_info

    @property

comment:4 Changed 11 years ago by Jun Omae

No, that is a TracForgePlugin issue, not a Trac issue.

The issue is probably caused by changing environ['PATH_INFO'] to unicode instance.

  • branches/bewst/0.11-clearsilver/tracforge/admin/dispatch.py

     
    164164                return self.start_response(*args)
    165165
    166166        environ['SCRIPT_NAME'] = req.href.projects('/')
    167         environ['PATH_INFO'] = path_info
     167        environ['PATH_INFO'] = path_info.encode('utf-8')
    168168        environ['trac.env_parent_dir'] = os.path.dirname(self.env.path)
    169169        if 'TRAC_ENV' in environ:
    170170            del environ['TRAC_ENV']

comment:5 Changed 9 years ago by Ryan J Ollos

Owner: Noah Kantrowitz deleted

comment:6 Changed 9 years ago by Ryan J Ollos

Owner: set to Ryan J Ollos
Resolution: fixed
Status: newclosed

In 15303:

Encode path_info as utf-8

Patch by jun66j5. Fixes #11388.

comment:7 Changed 9 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.