1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-06 22:04:19 +00:00

Fixed problem with double dot references to modules

This commit is contained in:
Jeremy Ruston 2012-01-07 17:31:57 +00:00
parent 41f33a8639
commit 3412580af3

View File

@ -10,8 +10,8 @@ function resolveModuleName(srcModule,dstModule) {
var src = srcModule.split("/"), var src = srcModule.split("/"),
dst = dstModule.split("/"), dst = dstModule.split("/"),
c; c;
// If the destination starts with ./ then it's a relative reference to an ordinary module // If the destination starts with ./ or ../ then it's a relative reference to an ordinary module
if(dstModule.substr(0,2) === "./" ) { if(dstModule.substr(0,2) === "./" || dstModule.substr(0,3) === "../" ) {
// Remove the filename part of the src path // Remove the filename part of the src path
src.splice(src.length-1,1); src.splice(src.length-1,1);
// Process the destination path bit by bit // Process the destination path bit by bit
@ -33,7 +33,7 @@ function resolveModuleName(srcModule,dstModule) {
} else if(dstModule.substr(0,1) === "/") { } else if(dstModule.substr(0,1) === "/") {
return dst.join("/"); return dst.join("/");
} else { } else {
// If there was no / or ./ then it's a built in module and the name doesn't need resolving // If there was no / or ./ or ../ then it's a built in module and the name doesn't need resolving
return dstModule; return dstModule;
} }
} }