Commit 841a7ac
committed
Fix regex URL exact match bug (issue #308)
URLs that exactly match a registered regex pattern string were incorrectly
dispatching to that resource instead of returning 404. For example,
registering `/foo/{v|[a-z]}/bar` and then requesting the literal URL
`/foo/{v|[a-z]}/bar` returned 200 instead of 404.
The root cause was that URLs with regex patterns were being added to
`registered_resources_str` (fast string lookup map). When a request
matched the literal pattern text, it bypassed regex validation.
Fix: Only add URLs without regex patterns to the fast string lookup map
by checking `idx.get_url_pars().empty()` before insertion.1 parent cbf6bfd commit 841a7ac
2 files changed
+1
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1595 | 1595 | | |
1596 | 1596 | | |
1597 | 1597 | | |
1598 | | - | |
1599 | 1598 | | |
1600 | | - | |
1601 | | - | |
1602 | | - | |
1603 | 1599 | | |
1604 | 1600 | | |
1605 | 1601 | | |
| |||
0 commit comments