Commit 3a4b7040 authored by Klaus Wölfel's avatar Klaus Wölfel Committed by Klaus Wölfel

[erp5_officejs] Fix error when converting new document with remote storage

In only office apps and notebook app download convert gadget produces error
when trying to convert a new document when using erp5 storage because it
redirects to the document with old jio_key which does not exist anymore
after syncing. The bug is fixed by introducing a cloudooo_only parameter
in ojs_sync gadget which is used to only sync cloudooo storage.
parent 263dabd9
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
} }
}) })
.push(function () { .push(function () {
return gadget.repair(); if (!gadget.state.cloudooo_only) {
  • I confirm this bug in only office. Could it be possible to avoid an ad-hoc if in sync gadget for this case? I don't know the cloudoo convert in deep detail, but may be there's a way to change the options.redirect content in cloudoo gadget to avoid this redirect issue?

  • After digging a bit this code, it seems the redirect parameter (naming is too generic and prevent understanding what it is...) is created AND handled in ojs_gadget_erp5_page_ojs_download_convert_js.

    In such case, why not only modifying this gadget (which can check a 404 and use another property to find the document with allDocs)?

    In ideal, I want to get rid of the 2 jIO storages (officejs/cloudooo) which are there as a workaround only.

  • allDocs query would be possible by using a unique property (or combination), such as modification date or reference+version+revision. Here some thoughts on possible drawbacks:

    • The download_conver gadget is used in several apps, for example onlyoffice. So should we make the existance of such property a requirment for all (future) apps using this gadget ?
    • As a user I want to convert without doing a full syn, this will not be possible anymore
  • I agree that the implementation could be improved with better api, but the idea of partial sync is valid in my opinion. Not only for fixing this bug but also for the following use cases:

    • With flacky connection (for example train), I want only export, not waiting for the full sync
    • I want export to work even when erp5 is down
    • I might later want a delete button so that I can create many notebooks by cloning existing notebooks in erp5 but many are only for playing, I do not want to upload them to erp5, so I delete them before syncing. But still I want to be able to export them
Please register or sign in to reply
return gadget.repair();
}
}) })
.push(function () { .push(function () {
if (gadget.state.redirect) { if (gadget.state.redirect) {
...@@ -47,7 +49,8 @@ ...@@ -47,7 +49,8 @@
return gadget.changeState({ return gadget.changeState({
auto_repair: options.auto_repair, auto_repair: options.auto_repair,
redirect: options.redirect, redirect: options.redirect,
cloudooo: result && true cloudooo: result && true,
cloudooo_only: options.cloudooo_only
}); });
}); });
}) })
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>969.42224.7621.358</string> </value> <value> <string>978.61273.2319.54766</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1534757989.87</float> <float>1570356085.27</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// declared methods // declared methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod("getConvertedBlob", function (options) { .declareMethod("getConvertedBlob", function (options) {
var gadget = this; var gadget = this, redirect;
return gadget.getSetting('file_extension') return gadget.getSetting('file_extension')
.push(function (file_extension) { .push(function (file_extension) {
if (file_extension === options.format) { if (file_extension === options.format) {
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
'options': { 'options': {
'page': 'ojs_sync', 'page': 'ojs_sync',
'auto_repair': true, 'auto_repair': true,
'cloudooo_only': true,
'redirect': options.redirect 'redirect': options.redirect
} }
}); });
...@@ -67,6 +68,7 @@ ...@@ -67,6 +68,7 @@
'options': { 'options': {
'page': 'ojs_sync', 'page': 'ojs_sync',
'auto_repair': true, 'auto_repair': true,
'cloudooo_only': true,
'redirect': options.redirect 'redirect': options.redirect
} }
}); });
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>969.46486.51629.28689</string> </value> <value> <string>978.61280.24884.63385</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1534770737.04</float> <float>1570356626.41</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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