mirror of https://gitee.com/bigwinds/arangodb
Fixed installing of Apps containing an internal app folder
This commit is contained in:
parent
ce7b75064a
commit
4543668a07
|
@ -102,14 +102,13 @@ describe("Foxx Manager install", function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
it("with malformed name", function() {
|
it("with malformed name", function() {
|
||||||
try {
|
try {
|
||||||
FoxxManager.install(fs.join(basePath, "malformed-name"), "/unittest/broken");
|
FoxxManager.install(fs.join(basePath, "malformed-name"), "/unittest/broken");
|
||||||
expect(true).toBeFalsy("Managed to install broken application");
|
expect(true).toBeFalsy("Managed to install broken application");
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
expect(e instanceof ArangoError).toBeTruthy();
|
expect(e instanceof ArangoError).toBeTruthy();
|
||||||
expect(e.errorNum).toEqual(errors.ERROR_MANIFEST_FILE_ATTRIBUTE_MISSING.code);
|
expect(e.errorNum).toEqual(errors.ERROR_INVALID_APPLICATION_MANIFEST.code);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -119,10 +118,9 @@ describe("Foxx Manager install", function() {
|
||||||
expect(true).toBeFalsy("Managed to install broken application");
|
expect(true).toBeFalsy("Managed to install broken application");
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
expect(e instanceof ArangoError).toBeTruthy();
|
expect(e instanceof ArangoError).toBeTruthy();
|
||||||
expect(e.errorNum).toEqual(errors.ERROR_MANIFEST_FILE_ATTRIBUTE_MISSING.code);
|
expect(e.errorNum).toEqual(errors.ERROR_INVALID_APPLICATION_MANIFEST.code);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
it("with malformed controller file", function() {
|
it("with malformed controller file", function() {
|
||||||
try {
|
try {
|
||||||
|
@ -243,6 +241,7 @@ describe("Foxx Manager install", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("success with", function() {
|
describe("success with", function() {
|
||||||
|
|
||||||
it("a minimal app", function() {
|
it("a minimal app", function() {
|
||||||
try {
|
try {
|
||||||
FoxxManager.install(fs.join(basePath, "minimal-working-manifest"), "/unittest/broken");
|
FoxxManager.install(fs.join(basePath, "minimal-working-manifest"), "/unittest/broken");
|
||||||
|
@ -251,6 +250,16 @@ describe("Foxx Manager install", function() {
|
||||||
}
|
}
|
||||||
FoxxManager.uninstall("/unittest/broken");
|
FoxxManager.uninstall("/unittest/broken");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("an app containing a sub-folder 'app'", function() {
|
||||||
|
try {
|
||||||
|
FoxxManager.install(fs.join(basePath, "interior-app-path"), "/unittest/broken");
|
||||||
|
} catch(e) {
|
||||||
|
expect(true).toBeFalsy("Could not install an app with sub-folder 'app'.");
|
||||||
|
}
|
||||||
|
FoxxManager.uninstall("/unittest/broken");
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("should not install on invalid mountpoint", function() {
|
describe("should not install on invalid mountpoint", function() {
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var filterAppRoots = function(folder) {
|
var filterAppRoots = function(folder) {
|
||||||
return /APP$/i.test(folder);
|
return /[\\\/]APP$/i.test(folder) && !/(APP[\\\/])(.*)APP$/i.test(folder);
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -292,7 +292,6 @@
|
||||||
mf = JSON.parse(fs.read(file));
|
mf = JSON.parse(fs.read(file));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
msg = "Cannot parse app manifest '" + file + "': " + String(err);
|
msg = "Cannot parse app manifest '" + file + "': " + String(err);
|
||||||
console.errorLines(msg);
|
|
||||||
throw new ArangoError({
|
throw new ArangoError({
|
||||||
errorNum: errors.ERROR_INVALID_APPLICATION_MANIFEST.code,
|
errorNum: errors.ERROR_INVALID_APPLICATION_MANIFEST.code,
|
||||||
errorMessage: errors.ERROR_INVALID_APPLICATION_MANIFEST.message
|
errorMessage: errors.ERROR_INVALID_APPLICATION_MANIFEST.message
|
||||||
|
@ -300,6 +299,19 @@
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
checkManifest(file, mf);
|
checkManifest(file, mf);
|
||||||
|
if (!/^[a-zA-Z\-_][a-zA-Z0-9\-_]*$/.test(mf.name)) {
|
||||||
|
throw new ArangoError({
|
||||||
|
errorNum: errors.ERROR_INVALID_APPLICATION_MANIFEST.code,
|
||||||
|
errorMessage: "The App name can only contain a to z, A to Z, 0-9, '-' and '_'."
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!/^\d+\.\d+(\.\d+)?$$/.test(mf.version)) {
|
||||||
|
throw new ArangoError({
|
||||||
|
errorNum: errors.ERROR_INVALID_APPLICATION_MANIFEST.code,
|
||||||
|
errorMessage: "The version requires the format: <major>.<minor>.<bugfix>, all have to be integer numbers."
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Manifest file '%s' is invald: %s", file, err.errorMessage);
|
console.error("Manifest file '%s' is invald: %s", file, err.errorMessage);
|
||||||
if (err.hasOwnProperty("stack")) {
|
if (err.hasOwnProperty("stack")) {
|
||||||
|
|
Loading…
Reference in New Issue