Commit d8716c4d authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

landingJS: make from path in zip optional

parent c9faec61
...@@ -61,7 +61,22 @@ ...@@ -61,7 +61,22 @@
} }
function loadZipIntoCrib(gadget, zip, from_path) { function loadZipIntoCrib(gadget, zip, from_path) {
var promise_list = []; var promise_list = [], path_list = [], root_path = "", i;
zip.forEach(function (relativePath, zipEntry) {
path_list.push(relativePath);
});
if (path_list && path_list.length > 1) {
root_path = path_list[0].split("/")[0];
for (i = 0; i < path_list.length - 1; i++) {
if (root_path !== path_list[i].split("/")[0]) {
root_path = "";
break;
}
}
}
if (root_path !== "" && !from_path) {
from_path = root_path;
}
zip.forEach(function (relativePath, zipEntry) { zip.forEach(function (relativePath, zipEntry) {
var end_url; var end_url;
if (zipEntry.dir) { if (zipEntry.dir) {
...@@ -141,7 +156,7 @@ ...@@ -141,7 +156,7 @@
site = getURL.protocol + "//" + getURL.host, site = getURL.protocol + "//" + getURL.host,
params = getParameterDict(), params = getParameterDict(),
data = { data = {
from_path: "cribjs-editor-master/", from_path: "",
to_path: site, to_path: site,
zip_url: "https://lab.nexedi.com/cedric.leninivin/cribjs-editor/" + zip_url: "https://lab.nexedi.com/cedric.leninivin/cribjs-editor/" +
"-/archive/master/cribjs-editor-master.zip", "-/archive/master/cribjs-editor-master.zip",
......
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