v0.38.1
This commit is contained in:
1 parent
faedd249b8
commit
758cfd6274
25 files changed
+973
-39
No files matched your search
@@ -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()
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user