Commit 3a024a3b authored by Boris Kocherov's avatar Boris Kocherov

erp5_officejs_ooffice: Improve error catching and informing

parent 5b2c8307
...@@ -30,6 +30,9 @@ if (Common === undefined) { ...@@ -30,6 +30,9 @@ if (Common === undefined) {
} }
function dataURLtoBlob(url) { function dataURLtoBlob(url) {
if (url === 'data:') {
return new Blob();
}
var byteString = atob(url.split(',')[1]), var byteString = atob(url.split(',')[1]),
mimeString = url.split(',')[0].split(':')[1].split(';')[0], mimeString = url.split(',')[0].split(':')[1].split(';')[0],
ab = new ArrayBuffer(byteString.length), ab = new ArrayBuffer(byteString.length),
...@@ -236,6 +239,9 @@ if (Common === undefined) { ...@@ -236,6 +239,9 @@ if (Common === undefined) {
g.props.jio_key = options.jio_key; g.props.jio_key = options.jio_key;
g.props.key = options.key || "text_content"; g.props.key = options.key || "text_content";
g.props.value = options.value; g.props.value = options.value;
if (g.props.value === "data:") {
g.props.value = undefined;
}
if (g.props.value) { if (g.props.value) {
if (g.props.value.slice === undefined) { if (g.props.value.slice === undefined) {
display_error(g, "not suported type of document value: " + display_error(g, "not suported type of document value: " +
...@@ -257,6 +263,13 @@ if (Common === undefined) { ...@@ -257,6 +263,13 @@ if (Common === undefined) {
type: "zipfile", type: "zipfile",
file: g.props.value file: g.props.value
}); });
g.props.value_zip_storage.getAttachment('/', 'body.txt')
.then(undefined, function (error) {
if (error.status_code === 404) {
display_error(g, 'not supported format: "' + g.props.value + '"');
}
display_error(g, error);
});
break; break;
default: default:
display_error(g, 'not supported format: "' + g.props.value + '"'); display_error(g, 'not supported format: "' + g.props.value + '"');
......
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.51056.50.46796</string> </value> <value> <string>955.60305.14946.31726</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481036322.7</float> <float>1481636304.19</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