Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

#1872 closed defect (fixed)

RTF displayed as plain text

Reported by: anonymous Owned by: Christian Boos
Priority: low Milestone: 0.9
Component: general Version: devel
Severity: normal Keywords: rtf mimeview
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Is it possible to render rich text format in trac? In r2040 .rtf attachments show up as plain text (quite impossible to read), is it atleast possible to tell the browser to download .rtf directly?

Attachments (0)

Change History (4)

comment:1 by Christopher Lenz, 19 years ago

Component: wikigeneral
Keywords: mimeview added
Milestone: 0.9
Severity: enhancementnormal
Summary: RTF supportRTF displayed as plain text

Better summary

comment:2 by Christian Boos, 19 years ago

Milestone: 0.9
Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

The is_binary heuristic will "fail" for RTF (and PDF, and PostScript…)

I would propose the following fix (would also fix #1920, I believe)

  • trac/mimeview/api.py

     
    7979    'rb':'text/x-ruby', 'ruby':'text/x-ruby',
    8080    'rfc':'text/x-rfc',
    8181    'rst': 'text/x-rst',
     82    'rtf':'application/rtf',
    8283    'scm':'text/x-scheme',
    8384    'sh':'application/x-sh',
    8485    'sql':'text/x-sql',
     
    328329        return 1
    329330
    330331    def render(self, req, mimetype, content, filename=None, rev=None):
    331         if is_binary(content):
     332        if is_binary(content) \
     333           or (mimetype.startswith('application/')
     334               and mimetype[12:] in ('pdf', 'postscript', 'rtf')):
    332335            self.env.log.debug("Binary data; no preview available")
    333336            return

comment:3 by Christian Boos, 19 years ago

PS: adding the above test in render and not in is_binary makes it possible to force the display of the actual text content in the browser by clicking on the Plain Text link.

comment:4 by Christian Boos, 19 years ago

Resolution: fixed
Status: assignedclosed

Should by fixed by r2108.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos 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.