mirror of https://gitee.com/bigwinds/arangodb
Fixed regex to identify Windows absolute and relative pathes also
This commit is contained in:
parent
32b4f5de19
commit
89a11587b3
|
@ -304,7 +304,7 @@
|
||||||
[ appInfo, mount ] );
|
[ appInfo, mount ] );
|
||||||
|
|
||||||
utils.validateMount(mount);
|
utils.validateMount(mount);
|
||||||
if (/^((\/)|(\.\/)|(\.\.\/))/.test(appInfo)) {
|
if (utils.pathRegex.test(appInfo)) {
|
||||||
appInfo = moveAppToServer(appInfo);
|
appInfo = moveAppToServer(appInfo);
|
||||||
}
|
}
|
||||||
var res;
|
var res;
|
||||||
|
|
|
@ -41,6 +41,7 @@ var ArangoError = arangodb.ArangoError;
|
||||||
var mountRegEx = /^(\/[a-zA-Z0-9_\-%]+)+$/;
|
var mountRegEx = /^(\/[a-zA-Z0-9_\-%]+)+$/;
|
||||||
var mountAppRegEx = /\/APP(\/|$)/i;
|
var mountAppRegEx = /\/APP(\/|$)/i;
|
||||||
var mountNumberRegEx = /^\/[\d\-%]/;
|
var mountNumberRegEx = /^\/[\d\-%]/;
|
||||||
|
var pathRegex = /^((\.{0,2}(\/|\\))|(~\/)|[a-zA-Z]:\\)/;
|
||||||
|
|
||||||
var getStorage = function() {
|
var getStorage = function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -487,6 +488,7 @@ exports.validateMount = validateMount;
|
||||||
exports.typeToRegex = typeToRegex;
|
exports.typeToRegex = typeToRegex;
|
||||||
exports.zipDirectory = zipDirectory;
|
exports.zipDirectory = zipDirectory;
|
||||||
exports.getStorage = getStorage;
|
exports.getStorage = getStorage;
|
||||||
|
exports.pathRegex = pathRegex;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- END-OF-FILE
|
// --SECTION-- END-OF-FILE
|
||||||
|
|
|
@ -720,7 +720,7 @@
|
||||||
installAppFromRemote(buildGithubUrl(appInfo), targetPath);
|
installAppFromRemote(buildGithubUrl(appInfo), targetPath);
|
||||||
} else if (/^https?:/i.test(appInfo)) {
|
} else if (/^https?:/i.test(appInfo)) {
|
||||||
installAppFromRemote(appInfo, targetPath);
|
installAppFromRemote(appInfo, targetPath);
|
||||||
} else if (/^((\/)|(\.\/)|(\.\.\/))/.test(appInfo)) {
|
} else if (utils.pathRegex.test(appInfo)) {
|
||||||
installAppFromLocal(appInfo, targetPath);
|
installAppFromLocal(appInfo, targetPath);
|
||||||
} else if (/^uploads\/tmp-/.test(appInfo)) {
|
} else if (/^uploads\/tmp-/.test(appInfo)) {
|
||||||
// Install from upload API
|
// Install from upload API
|
||||||
|
|
Loading…
Reference in New Issue