Opened 4 days ago

Closed 4 days ago

#36393 closed Bug (duplicate)

_5C in pk of related model turns into back slash (\) in admin url

Reported by: Nikolay Fedorov Owned by:
Component: contrib.admin Version: 5.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have two models: a Video and a Question. The "video" field in the Question model is a ForeignKey to the video model. If the video has pk = 'Ml_XFX_5CYo' and it is assigned to a question, then when you try to view or edit the video from the question page in the admin section, clicking on the link results in an error that the video with pk = 'Ml_XFX\Yo' does not exist. For some reason, when trying to access the video from the question card, 'Ml_XFX_5CYo' turns into 'Ml_XFX\Yo'. I think problem on django.contrib.admin.utils.quote function (maybe not). Presumably, the problem is that the url conversion or protection mechanism considers _5C as %5C and Ml_XFX_5CYo' turns into 'Ml_XFX\Yo'.

Attachments (3)

Снимок экрана 2025-05-14 в 23.58.41.png (15.7 KB ) - added by Nikolay Fedorov 4 days ago.
Снимок экрана 2025-05-14 в 23.58.57.png (12.1 KB ) - added by Nikolay Fedorov 4 days ago.
Снимок экрана 2025-05-14 в 23.59.25.png (20.5 KB ) - added by Nikolay Fedorov 4 days ago.

Download all attachments as: .zip

Change History (4)

comment:1 by Sarah Boyce, 4 days ago

Resolution: duplicate
Status: newclosed

Thank you for the report! I replicated and think this is a duplicate of #30386

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