Commit c1b3879e authored by Ivan Tyagov's avatar Ivan Tyagov

Converting raster image to SVG format can be quite memroy consuming which potentially can

cause running out of memory so enforce some restrictions by default which will prevent this.
parent f1403f12
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
if format in (\'svg\',):\n
image_pixels = context.getHeight()* context.getWidth()\n
max_pixels = 128*128 # default thumbnail size\n
if image_pixels > max_pixels:\n
# image is too big to be handled safely by ERP5 as it can lead to \n
# really high memory consumptions\n
return 0\n
return 1\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>format, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Image_checkConversionFormatPermission</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
1267
\ No newline at end of file
1268
\ No newline at end of file
......@@ -175,6 +175,7 @@ class TestDocumentMixin(ERP5TypeTestCase):
conversion_format_permission_script_id_list = [
'Document_checkConversionFormatPermission',
'Image_checkConversionFormatPermission',
'PDF_checkConversionFormatPermission']
def clearRestrictedSecurityHelperScript(self):
for script_id in self.conversion_format_permission_script_id_list:
......
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