Fix code to handle single dots in path

Before this fix adding a single dot to the end of a path would cause the
code to crash.
This commit is contained in:
bootandy
2019-07-02 00:56:43 +01:00
parent 7db6cf2f32
commit d327bd2e68
+1 -1
View File
@@ -50,7 +50,7 @@ pub fn get_dir_tree(
fn strip_end_slashes(s: &str) -> String {
let mut new_name = String::from(s);
while new_name.ends_with('/') && new_name.len() != 1 {
while (new_name.ends_with('/') || new_name.ends_with("/.")) && new_name.len() != 1 {
new_name.pop();
}
new_name