Commit 94bdc066 authored by Sidnei da Silva's avatar Sidnei da Silva

      - OFS.Image.manage_FTPget() would str() it's .data attribute,
        potentially loading the whole file in memory as a
        string. Changed to use RESPONSE.write() iterating through the
        Pdata chain, just like index_html().
parent 06438806
...@@ -33,6 +33,11 @@ Zope Changes ...@@ -33,6 +33,11 @@ Zope Changes
Bugs Fixed Bugs Fixed
- OFS.Image.manage_FTPget() would str() it's .data attribute,
potentially loading the whole file in memory as a
string. Changed to use RESPONSE.write() iterating through the
Pdata chain, just like index_html().
- When PageTemplates have a syntax error, show the traceback output - When PageTemplates have a syntax error, show the traceback output
in the rendered error message. in the rendered error message.
......
...@@ -594,6 +594,8 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -594,6 +594,8 @@ class File(Persistent, Implicit, PropertyManager,
def manage_FTPget(self): def manage_FTPget(self):
"""Return body for ftp.""" """Return body for ftp."""
RESPONSE = self.REQUEST.RESPONSE
if self.ZCacheable_isCachingEnabled(): if self.ZCacheable_isCachingEnabled():
result = self.ZCacheable_get(default=None) result = self.ZCacheable_get(default=None)
if result is not None: if result is not None:
...@@ -602,10 +604,19 @@ class File(Persistent, Implicit, PropertyManager, ...@@ -602,10 +604,19 @@ class File(Persistent, Implicit, PropertyManager,
# from FileCacheManager. # from FileCacheManager.
# the content-length is required here by HTTPResponse, even # the content-length is required here by HTTPResponse, even
# though FTP doesn't use it. # though FTP doesn't use it.
self.REQUEST.RESPONSE.setHeader('Content-Length', self.size) RESPONSE.setHeader('Content-Length', self.size)
return result return result
return str(self.data)
data = self.data
if type(data) is type(''):
RESPONSE.setBase(None)
return data
while data is not None:
RESPONSE.write(data.data)
data = data.next
return ''
manage_addImageForm=DTMLFile('dtml/imageAdd',globals(), manage_addImageForm=DTMLFile('dtml/imageAdd',globals(),
Kind='Image',kind='image') Kind='Image',kind='image')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment