fix for path.join problem when both string start with a "..", a unit test has been added
This commit is contained in:
parent
6058243aa1
commit
15ceabac48
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user