Edgewall Software
Modify

Opened 11 years ago

Closed 10 years ago

#11503 closed defect (fixed)

UnicodeDecodeError if no handler with unicode characters and trailing slash

Reported by: Jun Omae Owned by: Jun Omae
Priority: low Milestone: 1.0.3
Component: general Version: 0.12-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix raising UnicodeDecodeError when url has no handler and unicode characters with trailing slash.

API Changes:
Internal Changes:

Description

Visiting a link which is generated from [/UnicodeNaméAndTrailingSlash/] in wiki, the following occurs.

Traceback (most recent call last):
  File "/home/jun66j5/src/trac/edgewall/git/trac/web/main.py", line 522, in _dispatch_request
    dispatcher.dispatch(req)
  File "/home/jun66j5/src/trac/edgewall/git/trac/web/main.py", line 217, in dispatch
    req.redirect(req.href + target, permanent=True)
  File "/home/jun66j5/src/trac/edgewall/git/trac/web/href.py", line 186, in __add__
    return self.base + rhs
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 11: ordinal not in range(128)

Attachments (0)

Change History (3)

comment:1 by Ryan J Ollos, 10 years ago

Milestone: next-minor-0.12.xnext-stable-1.0.x

comment:2 by Jun Omae, 10 years ago

Milestone: next-stable-1.0.x1.0.3
Owner: set to Jun Omae
Status: newassigned

Proposed changes in jomae.git@t11503.

I noticed that adding unicode string to Href instance generates url with raw unicode characters. I think we should convert urlencoded characters.

>>> from trac.web.href import Href
>>> Href('/base') + u'nótfound'
u'/base/n\xf3tfound'

If [mainnav] and [metanav] have the following, the above issue would occur.

[mainnav]
; localized guidance for newticket
newticket.href = /wiki/チケット作成

comment:3 by Jun Omae, 10 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [13456-13457] and merged to trunk in [13459].

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'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.