#32710: static template tag converts '?' to '%3F'
---------------------------------+--------------------------------------
Reporter: Adrian Garcia | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 3.1
Severity: Normal | Resolution:
Keywords: static template | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by Adrian Garcia:
Old 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
New description:
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
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32710#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/080.2e84b65d56698abd30fc654646f91f8f%40djangoproject.com.