Ticket #5557 (closed defect: worksforme)
[PATCH]: Attachment download missing 'filename=' in header
| Reported by: | osimons <simon-code@…> | Owned by: | jonas |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | attachment | Version: | 0.10-stable |
| Severity: | normal | Keywords: | attachment |
| Cc: |
Description
Following [4946] an important piece of information for downloading attachments disappeared, and at least on IE7 the download/save dialogue is:
- only providing save option, and not the usual 'Open/Run' or 'Save'.
- missing file ending, so if you try to download 'mytool.exe' it will try to save only 'mytool' - having to add the ending manually, and regardless of file type.
- and, it will not recognize the file type, always listing it as 'Unknown File Type'.
Here is tested patch for 0.10-stable:
-
trac-0.10-stable/trac/attachment.py
561 561 # Force browser to download files instead of rendering 562 562 # them, since they might contain malicious code enabling 563 563 # XSS attacks 564 req.send_header('Content-Disposition', 'attachment') 564 req.send_header('Content-Disposition', 'attachment; ' + 565 'filename=' + attachment.filename) 565 566 if format == 'txt': 566 567 mime_type = 'text/plain' 567 568 elif not mime_type:
In all other modules where there is download, this seems to be correct - if the file is placed in htdocs and served through Chrome, it provides correct information. Also trying to download files in original format from wiki, browser and so on.
Patch tested on IE, Firefox, Camino and Safari.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


