This commit is contained in:
Mateusz Gruszczyński committed 2026-11-15 17:51:19 +01:00
1 parent faedd249b8
commit 758cfd6274
25 files changed
+973 -39

No files matched your search

+1 -1
View File
@@ -401,7 +401,7 @@ pub fn prefix_matches(prefix: &str, path: &str) -> bool {
|| path == prefix
|| path
.strip_prefix(prefix)
.is_some_and(|tail| tail.starts_with('/'))
.is_some_and(|tail| tail.starts_with('/') || prefix.ends_with('/'))
}
pub(crate) fn valid_id(id: &str) -> bool {
!id.is_empty()
+4
View File
@@ -689,6 +689,10 @@ mod tests {
assert!(prefix_matches("/api", "/api"));
assert!(prefix_matches("/api", "/api/users"));
assert!(!prefix_matches("/api", "/apix"));
assert!(prefix_matches("/api/", "/api/"));
assert!(prefix_matches("/api/", "/api/users"));
assert!(!prefix_matches("/api/", "/api"));
assert!(!prefix_matches("/api/", "/apix"));
assert!(prefix_matches("/", "/anything"));
}
#[test]