Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#34691 closed Cleanup/optimization (fixed)

Add a system check for unmatched URL paths' < / >

Reported by: Adam Johnson Owned by: Amir Karimi
Component: Core (System checks) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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)

comment:1 by Amir Karimi, 17 months ago

Owner: changed from nobody to Amir Karimi
Status: newassigned

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 '>'.

comment:2 by Mariusz Felisiak, 17 months ago

Component: Core (URLs)Core (System checks)
Triage Stage: UnreviewedAccepted

Sounds reasonable, this should raise a system check warning, not an error.

comment:4 by Mariusz Felisiak, 17 months ago

Patch needs improvement: set

comment:5 by Mariusz Felisiak, 17 months ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:6 by Mariusz Felisiak <felisiak.mariusz@…>, 17 months ago

Resolution: fixed
Status: assignedclosed

In d1855c48:

Fixed #34691 -- Added system check for unmatched angle brackets in path().

comment:7 by GitHub <noreply@…>, 17 months ago

In e5e9699:

Refs #34691 -- Optimized system check for unmatched angle brackets in path().

Follow up to d1855c4847215f3afe3708736be13388bb6437eb.

Note: See TracTickets for help on using tickets.
Back to Top