commit
f5d1cd1751
|
@ -23,6 +23,10 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// path.join seems to normalize by default, but we'll just be explicit
|
||||||
|
var rootTestFolder = path.normalize(path.join(npm.root, "../tests/frontend/"));
|
||||||
|
|
||||||
var url2FilePath = function(url){
|
var url2FilePath = function(url){
|
||||||
var subPath = url.substr("/tests/frontend".length);
|
var subPath = url.substr("/tests/frontend".length);
|
||||||
if (subPath == ""){
|
if (subPath == ""){
|
||||||
|
@ -30,8 +34,11 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
}
|
}
|
||||||
subPath = subPath.split("?")[0];
|
subPath = subPath.split("?")[0];
|
||||||
|
|
||||||
var filePath = path.normalize(npm.root + "/../tests/frontend/")
|
var filePath = path.normalize(path.join(rootTestFolder, subPath));
|
||||||
filePath += subPath.replace("..", "");
|
// make sure we jail the paths to the test folder, otherwise serve index
|
||||||
|
if (filePath.indexOf(rootTestFolder) !== 0) {
|
||||||
|
filePath = path.join(rootTestFolder, "index.html");
|
||||||
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue