Opened 4 years ago

Last modified 4 years ago

#32710 closed Bug

static template tag converts '?' to '%3F' — at Initial Version

Reported by: Adrian Garcia Owned by: nobody
Component: contrib.staticfiles Version: 3.1
Severity: Normal Keywords: static template
Cc: Florian Apolloner Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

As the title suggests, the static template tag converts all question marks to '%3F' which still seems to work, but I don't think this is intended.

Template code:

<script src="{% static 'bootstrap/js/bootstrap.bundle.min.js?test'%}"></script>

Output is:

<script src="/js/bootstrap.bundle.min.js%3Ftest"></script>

I followed the execution path and the replacement happens in django.utils.encoding.filepath_to_uri when urllib.parse.quote is called. I think '?' should be denoted as a safe character because otherwise, the function will replace it with a byte representation

Change History (0)

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