[ZCM] [ZC] 2355/ 4 Resubmit "Misclassifying text as text/html "

"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Sat, 15 Sep 2007 07:30:17 -0400
Newsgroups gmane.comp.web.zope.devel.collector-monitor
Message-ID <[email protected]>
Issue #2355 Update (Resubmit) "Misclassifying text as text/html "
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2355

==============================================================
= Resubmit - Entry #4 by ajung on Sep 15, 2007 7:30 am

 Status: Resolved => Pending

ups...closed the wrong issue
________________________________________
= Resolve - Entry #3 by ajung on Sep 15, 2007 6:53 am

 Status: Pending => Resolved

Patch applied to 2.10 branch and trunk.
________________________________________
= Comment - Entry #2 by ploneforge on Sep 3, 2007 9:26 pm


Uploaded:  "init__.py"
 - http://www.zope.org/Collectors/Zope/2355/init__.py/view
Oops - sorry this code has moved in 2.9.8 to  
Zope-2.9.8-final/lib/python/zope/app/content_types/__init__.py

The same logic applies as the code was duplicated. Attached is a slightly more elaborate patch that tries to be more efficient.


________________________________________
= Request - Entry #1 by ploneforge on Sep 3, 2007 9:15 pm


Uploaded:  "content_types.py"
 - http://www.zope.org/Collectors/Zope/2355/content_types.py/view
If a text file is uploaded without an extension in the filename,
text_type in lib/python/OFS/content_types.py is called to classify the text as text/html text/xml or text/plain. The very weak condition s.find('</') >= 0 is used for text/html, which means that if you are uploading a bunch of files via WebDAV to a ZWiki, without file extensions, anything with a </ in it gets classified as HTML, hence a Document not a WikiPage under Plone.

The code should be a bit more rigourous: a suggested patch is attached.

==============================================================