Modify

Opened 12 years ago

Closed 12 years ago

#138 closed defect (fixed)

Encoding problem with attachment filename

Reported by: debacle@… Owned by: bas
Priority: major Milestone:
Component: email2trac Version: 0.80
Keywords: Cc:

Description

I got an error message from email2trac (urllib.quote):

Traceback (most recent call last):
  File "/usr/bin/email2trac", line 1574, in <module>#012    tktparser.parse(sys.stdin)
  File "/usr/bin/email2trac", line 991, in parse#012    self.new_ticket(m, subject, spam_msg)
  File "/usr/bin/email2trac", line 805, in new_ticket#012    message_parts = self.unique_attachment_names(message_parts)
  File "/usr/bin/email2trac", line 1231, in unique_attachment_names#012    filename = urllib.quote(filename)
  File "/usr/lib/python2.5/urllib.py", line 1205, in quote#012    res = map(safe_map.__getitem__, s)
KeyError: u'\xf3'

Result was, that the ticket could not be created. I patched email2trac. Now it works, but I'm not sure, whether the patch is the best solution:

--- /usr/bin/email2trac.orig    2009-06-04 13:34:33.000000000 +0200
+++ /usr/bin/email2trac 2009-06-04 15:36:29.000000000 +0200
@@ -1228,7 +1228,7 @@
                                        pass
 
                        if self.QUOTE_ATTACHMENT_FILENAMES:
-                               filename = urllib.quote(filename)
+                               filename = urllib.quote(filename.encode('utf-8'))
 
                        # Make the filename unique for this ticket
                        num = 0

Attachments (0)

Change History (3)

comment:1 follow-up: Changed 12 years ago by bas

  • Status changed from new to assigned

thanks for the patch it look oke for me. Is the attachment clickable or inserted in the ticket if you acces via the web interface?

comment:2 in reply to: ↑ 1 Changed 12 years ago by debacle@…

Replying to bas:

Is the attachment clickable or inserted in the ticket if you acces via the web interface?

Clickable.

comment:3 Changed 12 years ago by bas

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [272]) email2trac.py.in:

Add Comment

Modify Ticket

Change Properties
Action
as closed The owner will remain bas.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.