]> git.lizzy.rs Git - minetest.git/commitdiff
Fix fs::RemoveRelativePathComponents for paths with a leading dot component
authorShadowNinja <shadowninja@minetest.net>
Thu, 24 Nov 2016 15:35:48 +0000 (10:35 -0500)
committerShadowNinja <shadowninja@minetest.net>
Thu, 24 Nov 2016 15:38:23 +0000 (10:38 -0500)
Previously, paths like ./worlds would be resolved to /worlds since the
leading dot was considered just as irrelevant as a dot in the middle of
the path.

src/filesys.cpp

index b4c52ab793b8bb1bb5331285767b159e7bd917c9..c718a9689fc8bcde8dd522dd91564ad7cdbe9061 100644 (file)
@@ -631,7 +631,7 @@ std::string RemoveRelativePathComponents(std::string path)
                std::string component = path.substr(component_start,
                                component_end - component_start);
                bool remove_this_component = false;
-               if(component == "."){
+               if(component == "." && component_start != 0){
                        remove_this_component = true;
                }
                else if(component == ".."){