fix: Trailing . and .. fix
This commit is contained in:
@@ -130,7 +130,7 @@ fn do_remove_dot_segments(path: String, acc: String) -> String {
|
|||||||
"/." -> acc <> "/"
|
"/." -> acc <> "/"
|
||||||
"/../" <> rest -> do_remove_dot_segments("/" <> rest, remove_segment(acc))
|
"/../" <> rest -> do_remove_dot_segments("/" <> rest, remove_segment(acc))
|
||||||
"/.." -> remove_segment(acc) <> "/"
|
"/.." -> remove_segment(acc) <> "/"
|
||||||
"." | ".." | "" -> acc
|
"." | ".." | "" -> acc <> path
|
||||||
_ -> {
|
_ -> {
|
||||||
let assert Ok(#(char, rest)) = string.pop_grapheme(path)
|
let assert Ok(#(char, rest)) = string.pop_grapheme(path)
|
||||||
do_remove_dot_segments(rest, acc <> char)
|
do_remove_dot_segments(rest, acc <> char)
|
||||||
|
|||||||
Reference in New Issue
Block a user