mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
clearer comments about the path handling behavior
This commit is contained in:
parent
3ebb19d8a2
commit
2e4374c08d
1 changed files with 5 additions and 2 deletions
|
@ -23,7 +23,10 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var rootTestFolder = path.join(npm.root, "..", "/tests/frontend/");
|
|
||||||
|
// 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 == ""){
|
||||||
|
@ -34,7 +37,7 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
var filePath = path.normalize(path.join(rootTestFolder, subPath));
|
var filePath = path.normalize(path.join(rootTestFolder, subPath));
|
||||||
// make sure we jail the paths to the test folder, otherwise serve index
|
// make sure we jail the paths to the test folder, otherwise serve index
|
||||||
if (filePath.indexOf(rootTestFolder) !== 0) {
|
if (filePath.indexOf(rootTestFolder) !== 0) {
|
||||||
filePath = path.normalize(path.join(rootTestFolder, "index.html"));
|
filePath = path.join(rootTestFolder, "index.html");
|
||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue