Commit 81f27149 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '865-info-about-problematic-zip-file' into 'devel_13.1.x'

info about problematic zip file is more verbose

See merge request minerva/core!843
parents 5ebd3ee3 962a0b5d
......@@ -157,7 +157,7 @@ AddProjectDialog.prototype.createGeneralTabContent = function () {
name: "project-file"
});
fileInput.addEventListener("change", function () {
return self.callListeners("onFileUpload", fileInput.files[0]).then(null, GuiConnector.alert);
return self.callListeners("onFileUpload", fileInput.files[0]).catch(GuiConnector.alert);
}, false);
self.addListener("onFileUpload", function (e) {
var file = e.arg;
......@@ -1449,7 +1449,12 @@ AddProjectDialog.prototype.createZipEntry = function (jsZipEntry, zipObject) {
type = "MAP";
data.root = true;
} else {
throw new ValidationError("Unrecognized file: " + filename);
var version = self.getConfiguration().getVersion();
var minorVersion = version.split(".")[0] + "." + version.split(".")[1];
var url = 'https://minerva.pages.uni.lu/doc/admin_manual/v' + minorVersion + '/advanced_upload/';
throw new ValidationError("Unrecognized file: " + filename + ". Please refer to <a target='#' href='" + url +
"'>manual</a> for information about allowed zip file content");
}
if (type === "MAP") {
var name = jsZipEntry.name.toLowerCase();
......
......@@ -97,6 +97,20 @@ describe('AddProjectDialog', function () {
return dialog.destroy();
});
});
it('invalid zip', function () {
var dialog = createDialog();
var file;
var buf = fs.readFileSync("testFiles/map/invalid-project.zip");
buf.name = "invalid-project.zip";
return dialog.init().then(function () {
return dialog.setZipFileContent(buf);
}).catch(function (e) {
assert.ok(e instanceof ValidationError);
}).finally(function () {
return dialog.destroy();
});
});
it('CellDesigner file', function () {
var dialog = createDialog();
var file;
......
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