Modify

Opened 6 years ago

Last modified 4 years ago

#3238 new defect

Problem with Unicode in filename

Reported by: anonymous Owned by: pacopablo
Priority: normal Component: SiteUploadPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Hi,
I'm using the newest version of the plugin for a 0.10.4 Trac install.
I suffered an unicode problem - which resulted in the following syslog entry:

Jun 24 09:51:20 projects Trac[main] ERROR: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128) Traceback (most recent call last):   File "/var/lib/python-support/python2.5/trac/web/main.py", line 406,
 in dispatch_request     dispatcher.dispatch(req)   File "/var/lib/python-support/python2.5/trac/web/main.py", line 237,
 in dispatch     resp = chosen_handler.process_request(req)   File "/usr/lib/python2.5/site-packages/TracWebAdmin-0.1.2dev_r5911-py2.5.egg/webadmin/web_ui.py", line 119,
 in process_request     path_info)   File "build/bdist.linux-i686/egg/siteupload/admin.py", line 70,
 in process_admin_request     self._render_view(req)   File "build/bdist.linux-i686/egg/siteupload/admin.py", line 83,
 in _render_view     self.env.href.chrome('site', f), f),   File "/var/lib/python-support/python2.5/trac/web/href.py", line 158,
 in <lambda>     self._derived[name] = lambda *args, **kw: self(name, *args, **kw)   File "/var/lib/python-support/python2.5/trac/web/href.py", line 143,
 in __call__     if arg != No

I was able to fix the problem with the attached patch.

Kind Regards,
Achim

Attachments (1)

SiteUpload.diff (754 bytes) - added by A.Spangler@… 6 years ago.
Patch to solve Unicode error

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by A.Spangler@…

Patch to solve Unicode error

comment:1 Changed 4 years ago by olaf.meeuwissen@…

  • Trac Release changed from 0.10 to 0.11

Facing the same problem here where people would like to use Japanese filenames.

First off, the patch seems to be reversed. There is no to_unicode in 0.10.4. Nor in 0.11.1, 0.11.5 or 0.11.7.

Second, removing the offending file(s) from the environments htdocs directory makes the Admin section usable again.

Third, when attaching the same file to a wiki page, all is well. This led me to check what attaching does differently. Well, it stores the file in a URL-encoded name using unicode_quote() and unicode_unquote() to switch between (user-visible) filenames and (file-system) paths.

Considering how various file systems may mangle, munch and otherwise mutilate Unicode paths, I would say the plugin needs a fix, not Trac proper. For inspiration, see trac:browser:trunk/trac/attachment.py.

Add Comment

Modify Ticket

Action
as new .
Author


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

 
Note: See TracTickets for help on using tickets.