1
0
Fork 0

Fixed regex to identify Windows absolute and relative pathes also

This commit is contained in:
Michael Hackstein 2015-02-23 15:07:03 +01:00
parent 32b4f5de19
commit 89a11587b3
3 changed files with 4 additions and 2 deletions

View File

@ -304,7 +304,7 @@
[ appInfo, mount ] );
utils.validateMount(mount);
if (/^((\/)|(\.\/)|(\.\.\/))/.test(appInfo)) {
if (utils.pathRegex.test(appInfo)) {
appInfo = moveAppToServer(appInfo);
}
var res;

View File

@ -41,6 +41,7 @@ var ArangoError = arangodb.ArangoError;
var mountRegEx = /^(\/[a-zA-Z0-9_\-%]+)+$/;
var mountAppRegEx = /\/APP(\/|$)/i;
var mountNumberRegEx = /^\/[\d\-%]/;
var pathRegex = /^((\.{0,2}(\/|\\))|(~\/)|[a-zA-Z]:\\)/;
var getStorage = function() {
"use strict";
@ -487,6 +488,7 @@ exports.validateMount = validateMount;
exports.typeToRegex = typeToRegex;
exports.zipDirectory = zipDirectory;
exports.getStorage = getStorage;
exports.pathRegex = pathRegex;
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE

View File

@ -720,7 +720,7 @@
installAppFromRemote(buildGithubUrl(appInfo), targetPath);
} else if (/^https?:/i.test(appInfo)) {
installAppFromRemote(appInfo, targetPath);
} else if (/^((\/)|(\.\/)|(\.\.\/))/.test(appInfo)) {
} else if (utils.pathRegex.test(appInfo)) {
installAppFromLocal(appInfo, targetPath);
} else if (/^uploads\/tmp-/.test(appInfo)) {
// Install from upload API