[ZCM] [ZC] 2355/ 5 Resolve "Misclassifying text as text/html "
"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Sun, 16 Sep 2007 06:37:32 -0400
| Newsgroups | gmane.comp.web.zope.devel.collector-monitor |
|---|---|
| Message-ID | <[email protected]> |
Issue #2355 Update (Resolve) "Misclassifying text as text/html "
Status Resolved, Zope/bug medium
To followup, visit:
http://www.zope.org/Collectors/Zope/2355
==============================================================
= Resolve - Entry #5 by ajung on Sep 16, 2007 6:37 am
Status: Pending => Resolved
Patch applied to the zope.contenttype trunk:
Log message for revision 79688:
Improved text_type(). Based on the patch from
http://www.zope.org/Collectors/Zope/2355/
Changed:
U zope.contenttype/trunk/CHANGES.txt
U zope.contenttype/trunk/src/zope/contenttype/__init__.py
U zope.contenttype/trunk/src/zope/contenttype/tests/testContentTypes.py
________________________________________
= 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.
==============================================================