mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
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:
+1
-1
@@ -50,7 +50,7 @@ pub fn get_dir_tree(
|
|||||||
|
|
||||||
fn strip_end_slashes(s: &str) -> String {
|
fn strip_end_slashes(s: &str) -> String {
|
||||||
let mut new_name = String::from(s);
|
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.pop();
|
||||||
}
|
}
|
||||||
new_name
|
new_name
|
||||||
|
|||||||
Reference in New Issue
Block a user