This commit is contained in:
euzu
2025-07-11 08:58:04 +02:00
parent 8510460e61
commit ceac359c0d
22 changed files with 130 additions and 86 deletions
+4 -3
View File
@@ -76,10 +76,11 @@ pub fn trim_slash(s: &str) -> Cow<str> {
pub fn trim_last_slash(s: &str) -> Cow<str> {
if s.ends_with('/') {
Cow::Owned(s[..s.len() - 1].to_string())
} else {
Cow::Borrowed(s)
if let Some(stripped) = s.strip_suffix('/') {
return Cow::Owned(stripped.to_string())
}
}
Cow::Borrowed(s)
}
#[cfg(test)]