Merge pull request #191 from Lusito/feature/pathjoinfix
fix for path.join problem when both string start with a "..", a unit …
This commit is contained in:
commit
25bb49e4d5
@ -71,6 +71,10 @@ int path_join(lua_State* L)
|
||||
break;
|
||||
}
|
||||
|
||||
if (start[0] == '.' && start[1] == '.' && start[2] == '\0'){
|
||||
break;
|
||||
}
|
||||
|
||||
/* otherwise trim segment and the ".." sequence */
|
||||
if (start != buffer) {
|
||||
--start;
|
||||
|
@ -267,6 +267,10 @@
|
||||
test.isequal("", path.join("p1/p2/", "../.."))
|
||||
end
|
||||
|
||||
function suite.join_OnBothUpTwoFolders()
|
||||
test.isequal("../../../../foo", path.join("../../", "../../foo"))
|
||||
end
|
||||
|
||||
function suite.join_OnUptwoFolders()
|
||||
test.isequal("p1/foo", path.join("p1/p2/p3", "../../foo"))
|
||||
end
|
||||
|
Reference in New Issue
Block a user