Commit d7e12e14 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_officejs_connector: Apply temporary fix to allow functioning behavior

parent 21c4706b
context.Base_prepareCorsResponse(RESPONSE=context.REQUEST.RESPONSE)
# XXX Base_download redirects to an HTML page on error !
# So the client resend a request to the given HTML page (which is bad),
# and CORS headers won't be set (which is correct) leading to
# request failure on app.officejs !
return context.Base_download(*args, **kw)
request = context.REQUEST
response = request.RESPONSE
context.Base_prepareCorsResponse(RESPONSE=response)
content_type = context.getContentType()
if (not content_type) or content_type.startswith("application/x-asc-"):
return context.index_html(request, response, format=None, inline=inline)
if context.getExternalProcessingState() == "converted":
return context.index_html(request, response, format="html", inline=inline)
return "No Data available (maybe wrong format or not ready yet)"
<?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>_params</string> </key>
<value> <string>inline=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Document_downloadForOnlyOfficeApp</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -294,7 +294,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: not here.getContentType() or here.getContentType().startswith("application/x-asc")</string> </value>
<value> <string>python: (not here.getContentType() and (not here.getData() or here.getData()[3:7] == "Y;v2")) or (here.getContentType().startswith("application/x-asc") and (not here.getData() or here.getData()[3:7] == "Y;v2"))</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -294,7 +294,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getContentType() and not here.getContentType().startswith("application/x-asc")</string> </value>
<value> <string>python: here.getContentType() and (not here.getContentType().startswith("application/x-asc") or (here.getData() and not here.getData()[3:7] == "Y;v2"))</string> </value>
</item>
</dictionary>
</pickle>
......
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