Edgewall Software
Modify

Opened 17 years ago

Closed 14 years ago

Last modified 14 years ago

#7076 closed defect (fixed)

[patch] Treat RTF files with .doc extension as binary

Reported by: uws@… 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 Thijs Triemstra)

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 the TREAT_AS_BINARY list

Trivial patch below:

  • trac/mimeview/api.py

    old new  
    7676    'application/pdf':        ['pdf'],
    7777    'application/postscript': ['ps'],
    7878    'application/rtf':        ['rtf'],
     79    'application/msword':     ['doc', 'dot'],
    7980    'application/x-sh':       ['sh'],
    8081    'application/x-csh':      ['csh'],
    8182    'application/x-troff':    ['nroff', 'roff', 'troff'],
     
    674675    TREAT_AS_BINARY = [
    675676        'application/pdf',
    676677        'application/postscript',
    677         'application/rtf'
     678        'application/rtf',
     679        'application/msword',
    678680    ]
    679681
    680682    def get_quality_ratio(self, mimetype):

Please include this in your upcoming releases.

Sincerely,

Wouter Bolsterlee <uws@…>

Attachments (1)

msword.patch (843 bytes ) - added by Thijs Triemstra 14 years ago.
updated patch against 0.12 stable

Download all attachments as: .zip

Change History (16)

comment:1 by Christian Boos, 17 years ago

Component: generalrendering
Keywords: msword added
Milestone: 0.11.1
Owner: changed from Jonas Borgström to Christian Boos
Severity: normalminor
Status: newassigned

Looks good, thanks.

comment:2 by Wouter Bolsterlee, 17 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 anonymous, 16 years ago

Component: renderingattachment
Version: 0.10.40.11-stable

comment:4 by Wouter Bolsterlee, 16 years ago

(Forgot to fill in my name, previous anonymous changes were by me.)

comment:5 by Christian Boos, 16 years ago

Milestone: 0.11-retriage0.11.5

comment:6 by Christian Boos, 15 years ago

Milestone: 0.11.60.12.1

by Thijs Triemstra, 14 years ago

Attachment: msword.patch added

updated patch against 0.12 stable

comment:7 by Thijs Triemstra, 14 years ago

Cc: Thijs Triemstra added
Keywords: patch added
Milestone: next-minor-0.12.x0.12.2

comment:8 by Remy Blank, 14 years ago

Owner: changed from Christian Boos to Remy Blank
Priority: normalhigh
Status: assignednew

Thanks for the update, I'll apply the patch.

comment:9 by uws@…, 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

comment:10 by Thijs Triemstra, 14 years ago

With 900+ tickets out there stuff sometimes gets lots I guess :)

comment:11 by uws@…, 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.

in reply to:  11 comment:12 by Thijs Triemstra, 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:13 by Remy Blank, 14 years ago

Resolution: fixed
Status: newclosed

Patch applied in [10367].

comment:14 by Remy Blank, 14 years ago

Owner: changed from Remy Blank to Thijs Triemstra

comment:15 by Thijs Triemstra, 14 years ago

Description: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Thijs Triemstra.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Thijs Triemstra to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.