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 , 19 years ago
Component: | wiki → general |
---|---|
Keywords: | mimeview added |
Milestone: | 0.9 |
Severity: | enhancement → normal |
Summary: | RTF support → RTF displayed as plain text |
comment:2 by , 19 years ago
Milestone: | → 0.9 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
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
79 79 'rb':'text/x-ruby', 'ruby':'text/x-ruby', 80 80 'rfc':'text/x-rfc', 81 81 'rst': 'text/x-rst', 82 'rtf':'application/rtf', 82 83 'scm':'text/x-scheme', 83 84 'sh':'application/x-sh', 84 85 'sql':'text/x-sql', … … 328 329 return 1 329 330 330 331 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')): 332 335 self.env.log.debug("Binary data; no preview available") 333 336 return
comment:3 by , 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.
Better summary