Commit bc1ac7a
authored
fix prefix-suffix conflict due to insertion order of trailing slashes
When inserting route parameters with static suffixes, `matchit` checked
for conflicts between newly inserted suffixes and existing ones. It had
an explicit exception to allow a new suffix that only differed by an
extra trailing slash (e.g., `o/` vs existing `o`).
However, this check only evaluated one direction: if the *new* suffix
was longer than the *existing* suffix. If the routes were inserted in
the reverse order (e.g., `o/` inserted first, then `o` inserted second),
the router incorrectly flagged them as a prefix-suffix conflict.
This commit makes the trailing slash check bidirectional by adding an
`else` branch to verify if the *existing* suffix is the one with the
extra trailing slash, resolving the insertion order dependency.1 parent 500698f commit bc1ac7a
2 files changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
226 | 231 | | |
227 | 232 | | |
228 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
260 | 264 | | |
261 | 265 | | |
262 | 266 | | |
| |||
0 commit comments