Opened 16 years ago
Last modified 10 years ago
#7724 new enhancement
Allow user provided mime-type for attachments
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | next-major-releases |
Component: | attachment | Version: | 0.12dev |
Severity: | major | Keywords: | excel word powerpoint office MicrosoftOffice MSOffice DOCX XLSX mime-type mimeviewer mime_map ZIP OpenXML IE InternetExplorer Office2007 PPTX |
Cc: | martin@…, Ryan J Ollos | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
While for svn repository files the 'svn:mime-type
' property can be used there is no way to explicit provide the mime-type for wiki attachments.
The files which mime-type is not automatically detected by Trac can not be correct inline displayed when the mime-type isn't provided by the user.
For source
files the correct svn:mime-type
can be set, but not for attachments.
This affects e.g. plugins implementing IHTMLPreviewRenderer
for non-standard mime-types. Here the plugin isn't used for attachments because of the missing correct mime-type.
Question: Is there a possibility to register a file extension with a curtain mime-type, without hacking /trac/mimeview/api.py
?
Attachments (0)
Change History (14)
comment:1 by , 16 years ago
Priority: | high → normal |
---|---|
Type: | defect → enhancement |
comment:2 by , 16 years ago
Thanks for the hint mgood, mime_map seems to work with my IHTMLPreviewRenderer plugin.
(But there should be still the possibility to provide the mime-type on a per-file base for attachments.)
comment:3 by , 16 years ago
Keywords: | consider added |
---|---|
Milestone: | → 2.0 |
A mime-type selector could be provided on the "Add attachment" page. Do you have a concrete use case where the mime-type should be selectable for every file, or did comment:1 solve your issues?
follow-ups: 5 10 comment:4 by , 16 years ago
Cc: | added |
---|
The tip mentioned in comment:1 solved my problem.
But IMHO there should be a mime-type selector at the "Add attachment" page, just in case for some special file formats which can't be identified by the file extension, e.g. sometimes the same extensions are used for different file types.
follow-up: 8 comment:5 by , 16 years ago
Keywords: | excel XLSX mime type mime_map added; consider removed |
---|---|
Version: | → 0.12dev |
This did not solve my issue. I have users uploading DOCX and XLSX files. In Firefox and Opera downloading works fine. But most have IE and it attempts to download as a ZIP file. Very odd. I changed the mime_map to the following but no joy.
mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb,application/msexcel:xlam:xlsb:xlsm:xltm:xlsx:xltx,application/ms-powerpoint:ppam:potm:pptm:ppsm:pptx:ppsx:potx,application/msword:docm:dotm:docx:dotx
comment:6 by , 16 years ago
While we're at it, it should be possible to also specify the encoding of a given attachment.
comment:7 by , 15 years ago
Cc: | added |
---|---|
Keywords: | word office DOCX ZIP added |
comment:8 by , 15 years ago
Replying to anonymous:
This did not solve my issue. I have users uploading DOCX and XLSX files. In Firefox and Opera downloading works fine. But most have IE and it attempts to download as a ZIP file. Very odd. I changed the mime_map to the following but no joy.
mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb,application/msexcel:xlam:xlsb:xlsm:xltm:xlsx:xltx,application/ms-powerpoint:ppam:potm:pptm:ppsm:pptx:ppsx:potx,application/msword:docm:dotm:docx:dotx
The following is working well for me,
[mimeviewer] mime_map = application/vnd.ms-word.document.macroEnabled.12:docm, application/vnd.openxmlformats-officedocument.wordprocessingml.document:docx, application/vnd.ms-word.template.macroEnabled.12:dotm, application/vnd.openxmlformats-officedocument.wordprocessingml.template:dotx, application/vnd.ms-powerpoint.template.macroEnabled.12:potm, application/vnd.openxmlformats-officedocument.presentationml.template:potx, application/vnd.ms-powerpoint.addin.macroEnabled.12:ppam, application/vnd.ms-powerpoint.slideshow.macroEnabled.12:ppsm, application/vnd.openxmlformats-officedocument.presentationml.slideshow:ppsx, application/vnd.ms-powerpoint.presentation.macroEnabled.12:pptm, application/vnd.openxmlformats-officedocument.presentationml.presentation:pptx, application/vnd.ms-excel.addin.macroEnabled.12:xlam, application/vnd.ms-excel.sheet.binary.macroEnabled.12:xlsb, application/vnd.ms-excel.sheet.macroEnabled.12:xlsm, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:xlsx, application/vnd.ms-excel.template.macroEnabled.12:xltm, application/vnd.openxmlformats-officedocument.spreadsheetml.template:xltx
References:
comment:9 by , 15 years ago
Keywords: | powerpoint MicrosoftOffice MSOffice mime-type mimeviewer OpenXML IE InternetExplorer Office2007 PPTX added; mime type removed |
---|
Another solution that I tested out which worked well was to change the svn:mime-type for the file from application/octet-stream to the corresponding application/vnd.* entry that it matched in the above list. Setting the mime_map
property is the easier solution since it affects all of the files downloaded from Trac, but I mention the other solution in case it might be useful for someone who doesn't have administrative rights to the server and wants a quick solution to the file download issue.
follow-up: 13 comment:10 by , 15 years ago
Replying to martin@…:
The tip mentioned in comment:1 solved my problem.
But IMHO there should be a mime-type selector at the "Add attachment" page, just in case for some special file formats which can't be identified by the file extension, e.g. sometimes the same extensions are used for different file types.
If this was added I'd vote for a trac.ini configuration parameter to show/hide the mime_type_selector
and also the proposed encoding_type_selector
, just for the sake of keeping Trac configurable in a light-weight mode with minimal options, which in some cases confuse certain end-users.
comment:12 by , 14 years ago
Milestone: | triaging → next-major-0.1X |
---|---|
Priority: | normal → low |
(for comment:3)
comment:13 by , 14 years ago
Replying to Ryan Ollos <ryano@…>:
Replying to martin@…:
The tip mentioned in comment:1 solved my problem.
But IMHO there should be a mime-type selector at the "Add attachment" page, just in case for some special file formats which can't be identified by the file extension, e.g. sometimes the same extensions are used for different file types.
If this was added I'd vote for a trac.ini configuration parameter to show/hide the
mime_type_selector
and also the proposedencoding_type_selector
, just for the sake of keeping Trac configurable in a light-weight mode with minimal options, which in some cases confuse certain end-users.
I agree with you here. Alternatively there could be an initial folded section like 'Further options' or 'Advanced options'. This would hide it from the normal user, but doesn't remove it completely.
comment:15 by , 10 years ago
Cc: | added; removed |
---|
The admin can map extensions to mime types using the mime_map option in the [mimeviewer] section of trac.ini (see TracIni#mimeviewer-section)