Opened 4 years ago

Last modified 4 years ago

#32710 closed Bug

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

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 (last modified by Adrian Garcia)

As the title suggests, the static template tag converts all question marks to '%3F' which will cause CSS and JS to fail to load.

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 (2)

comment:2 by Adrian Garcia, 4 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top