fix: do not autoescape static tag (#2376)

When using django-storage S3, this will escape the final static URL,
containing query string (so & will become &).
This commit is contained in:
Yohan Boniface 2024-12-17 18:30:06 +01:00 committed by GitHub
commit 8f3e9ee546
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 17 additions and 0 deletions

View file

@ -46,6 +46,7 @@ STORAGES = {
"secret_key": "yyy",
"bucket_name": "umap-pictograms",
"endpoint_url": "http://127.0.0.1:9000",
"default_acl": "public-read",
},
},
"data": {
@ -65,6 +66,7 @@ STORAGES = {
"secret_key": "yyy",
"bucket_name": "umapstatics",
"endpoint_url": "http://127.0.0.1:9000",
"default_acl": "public-read",
},
},
}

View file

@ -18,6 +18,7 @@
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
{# See https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs #}
{% autoescape off %}
<link rel="icon"
href="{% static 'umap/favicons/favicon.ico' %}"
sizes="32x32">
@ -28,6 +29,7 @@
href="{% static 'umap/favicons/apple-touch-icon.png' %}">
<!-- 180×180 -->
<link rel="manifest" href="/manifest.webmanifest">
{% endautoescape %}
</head>
<body class="{% block body_class %}{% endblock body_class %}">
{% block header %}

View file

@ -1,8 +1,10 @@
{% load i18n static %}
{% autoescape off %}
<style type="text/css">
@import "{% static 'umap/js/components/alerts/alert.css' %}";
</style>
{% endautoescape %}
<template id="umap-alert-template">
<div role="dialog" class="dark window umap-alert">
<div>
@ -97,6 +99,7 @@
</div>
</template>
<umap-alert-conflict></umap-alert-conflict>
{% autoescape off %}
<script type="module">
import { register } from '{% static 'umap/js/components/base.js' %}'
import {
@ -108,3 +111,4 @@
register(uMapAlertCreation, 'umap-alert-creation')
register(uMapAlertConflict, 'umap-alert-conflict')
</script>
{% endautoescape %}

View file

@ -1,5 +1,7 @@
{% load static %}
{% autoescape off %}
<link rel="stylesheet"
href="{% static 'umap/vendors/leaflet/leaflet.css' %}" />
<link rel="stylesheet"
@ -39,3 +41,4 @@
<link rel="stylesheet" href="{% static 'umap/css/tableeditor.css' %}" />
<link rel="stylesheet" href="{% static 'umap/css/bar.css' %}" />
<link rel="stylesheet" href="{% static 'umap/theme.css' %}" />
{% endautoescape %}

View file

@ -1,5 +1,6 @@
{% load static %}
{% autoescape off %}
<script type="module"
src="{% static 'umap/vendors/leaflet/leaflet-src.esm.js' %}"
defer></script>
@ -42,3 +43,4 @@
<script src="{% static 'umap/js/umap.forms.js' %}" defer></script>
<script src="{% static 'umap/js/umap.controls.js' %}" defer></script>
<script type="module" src="{% static 'umap/js/components/fragment.js' %}" defer></script>
{% endautoescape %}

View file

@ -5,7 +5,9 @@
</div>
<!-- djlint:off -->
<script defer type="module">
{% autoescape off %}
import Umap from '{% static "umap/js/modules/umap.js" %}'
{% endautoescape %}
U.MAP = new Umap("map", {{ map_settings|notag|safe }})
</script>
<!-- djlint:on -->

View file

@ -46,7 +46,9 @@
{% block bottom_js %}
{{ block.super }}
<script type="module">
{% autoescape off %}
import Umap from '{% static "umap/js/modules/umap.js" %}'
{% endautoescape %}
const CACHE = {}
for (const mapOpener of document.querySelectorAll("button.map-opener")) {
mapOpener.addEventListener('click', (event) => {