Ticket #205 (closed defect: fixed)

Opened 9 months ago

Last modified 9 months ago

Bug with attachments whose filename contains a space

Reported by: sjrd Owned by: somebody
Priority: major Milestone: 0.1
Component: Viewing topics Version: devel
Keywords: attachment space Cc:
Blocked By: Blocking:

Description

Hi,

When downloading an attachment whose filename contains a space, e.g. "My great file.txt", the HTTP header (Content-Disposition) telling the name of the file is corrupt.

The result is that the Save dialog of the browser suggests "My" as filename. This is really bad, because the extension is stripped off, and then the user can't open the file.

The fix is easy. In views.py, near the bottom of the file, in function "def show_attachment". Just surround the %s with double quotes. This yields this line:

responseContent-Disposition? = 'attachment; filename="%s"' % smart_str(attachment.name)

This is in accordance with RFC 2183:
http://www.ietf.org/rfc/rfc2183.txt

I would have provided a changeset, but I'm not quite at ease with hg; I prefer git. And since the fix is two chars long... The trouble was not worth it.

Change History

comment:1 Changed 9 months ago by slav0nic

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

tnx )

Note: See TracTickets for help on using tickets.