[zope2-tracker] [Bug 903251] [NEW] ZPublisher setting improper content-type for images
Andreas Jung
lists at zopyx.com
Mon Dec 12 15:54:07 UTC 2011
Public bug reported:
An image inside a Plone 4 site is rendered using Collage with an URL
http://zopyx.com:31240/ise/de/Leistungsangebot_tcm74002.jpg/image
'image' refers to the full-scale version of the image.
Zope delivers the image with content-type text/html
--2011-12-12 16:52:18-- http://ise.veit-schiele.de:31240/ise/de/Leistungsangebot_tcm74002.jpg/image
Resolving ise.veit-schiele.de... 83.223.91.163
Connecting to ise.veit-schiele.de|83.223.91.163|:31240... connected.
HTTP request sent, awaiting response...
HTTP/1.0 200 OK
Server: Zope/(2.12.17, python 2.6.4, linux2) ZServer/1.1
Date: Mon, 12 Dec 2011 15:52:16 GMT
Content-Length: 67856
Content-Type: text/html; charset=utf-8
Connection: Keep-Alive
Set-Cookie: I18N_LANGUAGE="de"; Path=/
Length: 67856 (66K) [text/html]
Some debugging show the culprit within the isHTML() method of the
ZPublisher.
112892 tseaver def isHTML(self, s):
112892 tseaver s = s.lstrip()
112892 tseaver # Note that the string can be big, so s.lower().startswith() is more
112892 tseaver # expensive than s[:n].lower().
112892 tseaver if (s[:6].lower() == '<html>' or s[:14].lower() == '<!doctype html'):
112892 tseaver return 1
112892 tseaver if s.find('</') > 0:
112892 tseaver return 1
112892 tseaver return 0
The s.find('</') call returns a value > 0 - obviously the image is containing a byte sequence
matching here.
** Affects: zope2
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.
https://bugs.launchpad.net/bugs/903251
Title:
ZPublisher setting improper content-type for images
To manage notifications about this bug go to:
https://bugs.launchpad.net/zope2/+bug/903251/+subscriptions
More information about the zope2-tracker
mailing list