Ticket #5504 (closed Bug: fixed)

Opened 10 years ago

Last modified 7 years ago

OpenDocument files shown as garbage text

Reported by: stainsby Owned by: alecm
Priority: minor Milestone: 2.1.3
Component: General Version:
Keywords: Cc:


When I add an OpenOffice Write (.odt) file, the MIME type is detected correctly as "File type application/vnd.oasis.opendocument.text". However, the page template decides to try to render the contents under "File contents", with garbage text as the result.

The cause is clear: in portal_skins/plone_content/file_view, the decision to display the contents of a file is made by searching for the substring 'text' in the MIME type (OMG!). A quick fix can be hacked in by replacing:

tal:condition="python:test(content_type.find('text')>-1, 1,0)"


tal:condition="python:test(not content_type.startswith('application/vnd.oasis.opendocument.') and (content_type.find('text')>-1), 1,0)"

but that is clearly unsatisfactory for general use.

A possible fix: The mimetype_registry has a boolean "binary' property for each MIME type. I suggest that this should be used.

Change History

comment:1 Changed 10 years ago by runyaga

what about:

content_type.startswith('text') or not mtr.isbinary(content_type)

this should be good enough.

comment:2 Changed 10 years ago by hannosch

  • Status changed from new to closed
  • Resolution set to fixed

(In [9684]) OpenDocument files are no longer shown as garbage text. This fixes #5504.

comment:3 Changed 7 years ago by hannosch

  • Component changed from Content Types to Infrastructure

comment:4 Changed 4 years ago by davisagli

  • Component changed from Infrastructure to General
Note: See TracTickets for help on using tickets.