#7076 closed defect (fixed)
[patch] Treat RTF files with .doc extension as binary
Reported by: | Owned by: | Thijs Triemstra | |
---|---|---|---|
Priority: | high | Milestone: | 0.12.2 |
Component: | attachment | Version: | 0.11-stable |
Severity: | minor | Keywords: | msword, patch |
Cc: | Thijs Triemstra | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Some .doc files have an application/rdf
mime type, e.g. Abiword export-as-doc actually saves a RTF file with a .doc filename. These files are not handled correctly by the Trac MIME viewer, since those RTF files are incorrectly shown as text. The special handling code for RTF (and PostScript and PDF) does not catch this case.
The fix is quite simple:
- Detect .doc and .dot files as
application/msword
- Add
application/msword
to theTREAT_AS_BINARY
list
Trivial patch below:
-
trac/mimeview/api.py
old new 76 76 'application/pdf': ['pdf'], 77 77 'application/postscript': ['ps'], 78 78 'application/rtf': ['rtf'], 79 'application/msword': ['doc', 'dot'], 79 80 'application/x-sh': ['sh'], 80 81 'application/x-csh': ['csh'], 81 82 'application/x-troff': ['nroff', 'roff', 'troff'], … … 674 675 TREAT_AS_BINARY = [ 675 676 'application/pdf', 676 677 'application/postscript', 677 'application/rtf' 678 'application/rtf', 679 'application/msword', 678 680 ] 679 681 680 682 def get_quality_ratio(self, mimetype):
Please include this in your upcoming releases.
Sincerely,
Wouter Bolsterlee <uws@…>
Attachments (1)
Change History (16)
comment:1 by , 17 years ago
Component: | general → rendering |
---|---|
Keywords: | msword added |
Milestone: | → 0.11.1 |
Owner: | changed from | to
Severity: | normal → minor |
Status: | new → assigned |
comment:2 by , 16 years ago
Any chance this gets committed any time soon? It's a trivial patch and would help a lot of users (hopefully).
comment:3 by , 16 years ago
Component: | rendering → attachment |
---|---|
Version: | 0.10.4 → 0.11-stable |
comment:5 by , 16 years ago
Milestone: | 0.11-retriage → 0.11.5 |
---|
comment:6 by , 15 years ago
Milestone: | 0.11.6 → 0.12.1 |
---|
comment:7 by , 14 years ago
Cc: | added |
---|---|
Keywords: | patch added |
Milestone: | next-minor-0.12.x → 0.12.2 |
comment:8 by , 14 years ago
Owner: | changed from | to
---|---|
Priority: | normal → high |
Status: | assigned → new |
Thanks for the update, I'll apply the patch.
comment:9 by , 14 years ago
Wow, finally some activity on this bug after ~30 months! I totally forgot about this, but feel a bit sad now that I it has bitrotted for so long. Sigh.
<sarcasm>Well done! This really encourages people to contribute to the project!</sarcasm>
— Wouter Bolsterlee
follow-up: 12 comment:11 by , 14 years ago
Sure, but somehow in Gnome Bugzilla or Launchpad I have never seen well-described issues with patches get lost for so long… so this is still a project problem imho.
comment:12 by , 14 years ago
Replying to uws@…:
Sure, but somehow in Gnome Bugzilla or Launchpad I have never seen well-described issues with patches get lost for so long… so this is still a project problem imho.
I've been going through tickets for a few weeks now, and out of the 900 tickets I found 1 other 'stray' ticket like this (#6289). I wouldn't call it a 'project problem'. Thanks for the patch!
comment:14 by , 14 years ago
Owner: | changed from | to
---|
comment:15 by , 14 years ago
Description: | modified (diff) |
---|
Looks good, thanks.