mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 09:54:41 -05:00
This commit is contained in:
@@ -85,7 +85,12 @@ impl<T: AsPath> PossibleRouteMatch for StaticSegment<T> {
|
||||
for char in test {
|
||||
let n = this.next();
|
||||
// when we get a closing /, stop matching
|
||||
if char == '/' || n.is_none() {
|
||||
if char == '/' {
|
||||
if n.is_some() {
|
||||
return None;
|
||||
}
|
||||
break;
|
||||
} else if n.is_none() {
|
||||
break;
|
||||
}
|
||||
// if the next character in the path matches the
|
||||
@@ -269,4 +274,15 @@ mod tests {
|
||||
let params = matched.params();
|
||||
assert!(params.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_match_full_static_paths() {
|
||||
let def = (StaticSegment("tests"), StaticSegment("abc"));
|
||||
assert!(def.test("/tes/abc").is_none());
|
||||
assert!(def.test("/test/abc").is_none());
|
||||
assert!(def.test("/tes/abc/").is_none());
|
||||
assert!(def.test("/test/abc/").is_none());
|
||||
assert!(def.test("/tests/ab").is_none());
|
||||
assert!(def.test("/tests/ab/").is_none());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user