[Django] #36940: Improve ASGI script prefix path_info handling

1 view
Skip to first unread message

Django

unread,
Feb 22, 2026, 3:51:27 AM (4 days ago) Feb 22
to django-...@googlegroups.com
#36940: Improve ASGI script prefix path_info handling
-------------------------------------+-------------------------------------
Reporter: KhadyotTakale | Type: Bug
Status: new | Component: HTTP
| handling
Version: 6.0 | Severity: Normal
Keywords: asgi script-prefix | Triage Stage:
path-info | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
The current ASGIRequest.__init__ uses str.removeprefix() to strip the
script name from the request path to compute path_info. This is fragile
because removeprefix is a pure string operation — it doesn't verify that
the prefix is a proper path segment boundary.

For example, if script_name is /myapp and the path is /myapplication/page,
removeprefix would incorrectly produce lication/page.

This patch replaces removeprefix with a check that ensures the script name
is followed by / or is the exact path, before stripping it. This addresses
the inline TODO comment.
--
Ticket URL: <https://code.djangoproject.com/ticket/36940>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 22, 2026, 3:55:44 AM (4 days ago) Feb 22
to django-...@googlegroups.com
#36940: Improve ASGI script prefix path_info handling
-------------------------------------+-------------------------------------
Reporter: Khadyot Takale | Owner: (none)
Type: Bug | Status: new
Component: HTTP handling | Version: 6.0
Severity: Normal | Resolution:
Keywords: asgi script-prefix | Triage Stage:
path-info | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Khadyot Takale):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36940#comment:1>

Django

unread,
Feb 23, 2026, 11:55:18 AM (3 days ago) Feb 23
to django-...@googlegroups.com
#36940: Improve ASGI script prefix path_info handling
-------------------------------------+-------------------------------------
Reporter: Khadyot Takale | Owner: anurag629
Type: Bug | Status: assigned
Component: HTTP handling | Version: 6.0
Severity: Normal | Resolution:
Keywords: asgi script-prefix | Triage Stage:
path-info | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by anurag629):

* owner: (none) => anurag629
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36940#comment:2>

Django

unread,
Feb 24, 2026, 10:12:28 AM (2 days ago) Feb 24
to django-...@googlegroups.com
#36940: Improve ASGI script prefix path_info handling
-------------------------------------+-------------------------------------
Reporter: Khadyot Takale | Owner: Khadyot
| Takale
Type: Bug | Status: assigned
Component: HTTP handling | Version: 6.0
Severity: Normal | Resolution:
Keywords: asgi script-prefix | Triage Stage:
path-info | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by JaeHyuckSa):

* owner: Anurag Verma => Khadyot Takale

--
Ticket URL: <https://code.djangoproject.com/ticket/36940#comment:3>

Django

unread,
Feb 25, 2026, 4:00:06 PM (19 hours ago) Feb 25
to django-...@googlegroups.com
#36940: Improve ASGI script prefix path_info handling
-------------------------------------+-------------------------------------
Reporter: Khadyot Takale | Owner: Khadyot
| Takale
Type: Bug | Status: assigned
Component: HTTP handling | Version: 6.0
Severity: Normal | Resolution:
Keywords: asgi script-prefix | Triage Stage: Accepted
path-info |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* easy: 1 => 0
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* stage: Unreviewed => Accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/36940#comment:4>
Reply all
Reply to author
Forward
0 new messages