Opened 15 years ago
Closed 15 years ago
#141 closed defect (duplicate)
Attachment with "ü" causes python error an is not attached
Reported by: | hju@… | Owned by: | bas |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | email2trac | Version: | 0.3 |
Keywords: | Cc: |
Description
We found a problem with python-code execution if there is an german "Umlaut" (ü) in the filename of an attachment.
email2trac produces an error in the user.log of the server { Mar 10 17:00:04 ks35958 email2trac: Traceback (most recent call last): Mar 10 17:00:04 ks35958 email2trac: File "/usr/bin/email2trac", line 1249, in ? tktparser.parse(sys.stdin) Mar 10 17:00:04 ks35958 email2trac: File "/usr/bin/email2trac", line 818, in parse self.new_ticket(m, spam_msg) Mar 10 17:00:04 ks35958 email2trac: File "/usr/bin/email2trac", line 757, in new_ticket str = self.attachments(msg, tkt) Mar 10 17:00:04 ks35958 email2trac: File "/usr/bin/email2trac", line 1049, in attachments url_filename = urllib.quote(filename) Mar 10 17:00:04 ks35958 email2trac: File "urllib.py", line 1110, in quote res = map(safe_map.getitem, s) Mar 10 17:00:04 ks35958 email2trac: KeyError?: u'\xfc' }
The ticket is created, but the attachment is not added.
Tracking down the error leads to an python-error in 2.4. The routine "quote", trying to encode special characters in the filename as "%<##>", returns an KeyError? with "\xfc" (ü).
http://bugs.python.org/issue3300
However: Is there possible workaround usin another python-function?
We use a trunk-version (218) of Version 0.30
P.S.: in another environment, we are using email2trac version 0.80 with python 2.5 under windows... Under this circumstances, there is no ticket createt at all...
Attachments (0)
Change History (7)
comment:1 Changed 15 years ago by bas
- Status changed from new to assigned
comment:2 Changed 15 years ago by hju@…
sorry, that is not possible.
But you can reproduce the problem with any attachment containing an ü in the filename.
I'll attache one.
comment:3 Changed 15 years ago by anonymous
Sorry, cant attache it
Oops… Trac detected an internal error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128) There was an internal error in Trac. It is recommended that you inform your local Trac administrator and give him all the information he needs to reproduce the issue. To that end, you could ==== How to Reproduce ==== While doing a POST operation on `/attachment/ticket/141/`, Trac issued an internal error. ''(please provide additional details here)'' Request parameters: {{{ {'__FORM_TOKEN': u'fabea936cc161c1d29b9e2b7', 'action': u'new', 'attachment': FieldStorage('attachment', '\xc3\xbcbergabe.txt', 'Testanlage f\xfcr Dateinamen mit \xfc'), 'author': u'hju@jochenkuhl.de', 'description': u'excample for attachment not working', 'id': u'141', 'path': u'141/', 'realm': u'ticket'} }}} ==== System Information ==== || '''Trac''' || `0.11` || || '''Python''' || `2.5.2 (r252:60911, Jan 4 2009, 22:17:10) ` [[br]] `[GCC 4.3.2]` || || '''setuptools''' || `0.6c8` || || '''SQLite''' || `3.5.9` || || '''pysqlite''' || `2.4.1` || || '''Genshi''' || `0.5` || || '''mod_python''' || `3.3.1` || || '''Subversion''' || `1.5.1 (r32289)` || ==== Python Traceback ==== {{{ Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/web/main.py", line 423, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/web/main.py", line 197, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/attachment.py", line 393, in process_request self._do_save(req, attachment) File "/usr/lib/python2.5/site-packages/Trac-0.11-py2.5.egg/trac/attachment.py", line 562, in _do_save attachment): File "build/bdist.linux-x86_64/egg/tracspamfilter/adapters.py", line 135, in validate_attachment FilterSystem(self.env).test(req, author, changes) File "build/bdist.linux-x86_64/egg/tracspamfilter/api.py", line 104, in test content = self._combine_changes(changes) File "build/bdist.linux-x86_64/egg/tracspamfilter/api.py", line 239, in _combine_changes return sep.join(fields) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128) }}} a ticket at this site. The action that triggered the error was: POST: /attachment/ticket/141/
comment:4 Changed 15 years ago by bas
So teh trac version currently installed can also not handle an attachment with this speical character.
I just need a raw email message. So i can test it.
comment:5 Changed 15 years ago by bas
Sorry but now i remember it, can you test teh trunk version, see changelog
* Error in urllib.quote(filename) could not handle unicode filenames, closes #138 Reported by: debacle at debian dot org Applied by: Bas van der Vlies
comment:6 Changed 15 years ago by anonymous
looking at the ticket #138 seems good.
Sorry for duplicating the error. I was searching for it but i didn't found it. We will test this trunk version.
comment:7 Changed 15 years ago by hju@…
- Resolution set to duplicate
- Status changed from assigned to closed
Introducing this little patch in our "old" trunk version fixes the problem as far as the Ü is translated to %C3%BC
The attachment ist there - the problem ist fixed. Beautification may be done later...
Thanks for reporting, can attach teh original message for me, that is dumped in /vr/tmp. So i can etst it locally.