Skip to content

Commit 500698f

Browse files
iksuddleibraheemdev
authored andcommitted
fix false conflict
1 parent 33faebd commit 500698f

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ impl<T> Node<T> {
319319

320320
// Similarly, we are inserting a parameter suffix and this node already has a parameter
321321
// prefix, we have a prefix-suffix conflict.
322-
let suffix = remaining.slice_off(wildcard.end);
322+
let suffix = remaining.slice_until(terminator).slice_off(wildcard.end);
323323
if !matches!(*suffix, b"" | b"/") && node.prefix_wild_child_in_segment() {
324324
return Err(InsertError::conflict(&route, remaining, node));
325325
}

tests/insert.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ fn prefix_suffix_conflict() {
255255
("/x15/prefix{a}", Ok(())),
256256
("/x16/{*rest}", Ok(())),
257257
("/x16/prefix{a}suffix", Ok(())),
258+
("/x17/prefix{a}/z", Ok(())),
259+
("/x18/prefix{a}/z", Ok(())),
258260
])
259261
.run()
260262
}

0 commit comments

Comments
 (0)