Ticket #205 (closed defect: fixed)
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.

tnx )