aboutsummaryrefslogtreecommitdiff
path: root/src/utilities.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-07-08 04:50:54 +0000
committerFuwn <[email protected]>2025-07-08 04:50:54 +0000
commit1776a876c1b032a4c9fa111f2d55b0656096c4cc (patch)
treed55a54b567d0bf4e365f93b6917440e718849e9e /src/utilities.rs
parentfeat(router): Add options system (diff)
downloadwindmark-1776a876c1b032a4c9fa111f2d55b0656096c4cc.tar.xz
windmark-1776a876c1b032a4c9fa111f2d55b0656096c4cc.zip
refactor(router): Smarter trailing slash clipper
Diffstat (limited to 'src/utilities.rs')
-rw-r--r--src/utilities.rs27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/utilities.rs b/src/utilities.rs
index 663c26f..1eb4831 100644
--- a/src/utilities.rs
+++ b/src/utilities.rs
@@ -40,30 +40,3 @@ pub fn params_to_hashmap(
.map(|(k, v)| (k.to_string(), v.to_string()))
.collect()
}
-
-/// Normalizes a path by removing all trailing slashes, unless it's the root
-/// path "/".
-///
-/// # Examples
-///
-/// ```rust
-/// assert_eq!(
-/// windmark::utilities::normalize_path_slashes("/foo///"),
-/// "/foo"
-/// );
-/// assert_eq!(windmark::utilities::normalize_path_slashes("/foo/"), "/foo");
-/// assert_eq!(windmark::utilities::normalize_path_slashes("/foo"), "/foo");
-/// assert_eq!(windmark::utilities::normalize_path_slashes("/"), "/");
-/// ```
-#[must_use]
-pub fn normalize_path_slashes(path: &str) -> String {
- if path == "/" {
- return "/".to_string();
- }
-
- if path.ends_with('/') {
- path.trim_end_matches('/').to_string()
- } else {
- path.to_string()
- }
-}