Edgewall Software

Ticket #1872 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

RTF displayed as plain text

Reported by: anonymous Owned by: cboos
Priority: low Milestone: 0.9
Component: general Version: devel
Severity: normal Keywords: rtf mimeview
Cc:

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

Change History

Changed 3 years ago by cmlenz

  • keywords mimeview added
  • summary changed from RTF support to RTF displayed as plain text
  • component changed from wiki to general
  • severity changed from enhancement to normal
  • milestone 0.9 deleted

Better summary

Changed 3 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned
  • milestone set to 0.9

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 

Changed 3 years ago by cboos

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.

Changed 3 years ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

Should by fixed by r2108.

Add/Change #1872 (RTF displayed as plain text)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.