Add a system check for unmatched URL paths' < / >
Currently, unmatched angle brackets are silently ignored:
path('<int:question_id/vote/', views.vote, name='vote'),
This leads to a frustrating debugging experience, where a 404 or NoReverseMatch
could occur and only the eagle-eyed could spot why. Similar to the ^
/$
system check added in #28663, I propose a new check in RoutePattern.check()
for unmatched <
or >
. It's rather unlikely those characters are legitimately used in URLs.
(Inspired by a new user making this mistake and asking for help on the forum.)
Change History
(7)
Owner: |
changed from nobody to Amir Karimi
|
Status: |
new → assigned
|
Component: |
Core (URLs) → Core (System checks)
|
Triage Stage: |
Unreviewed → Accepted
|
Patch needs improvement: |
set
|
Patch needs improvement: |
unset
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Seems essential. I can work on it by splitting the routes based on '/' and checking if each part having started with '<' must have ended with '>'.