fix: encode the whole url parameter for OEmbed
See https://github.com/umap-project/umap/pull/1526#issuecomment-1937040472
This commit is contained in:
parent
148c119c05
commit
9426570b6e
3 changed files with 5 additions and 5 deletions
|
@ -17,7 +17,7 @@
|
|||
{% umap_js locale=locale %}
|
||||
{% if object.share_status != object.PUBLIC %}<meta name="robots" content="noindex">{% endif %}
|
||||
<link rel="alternate" type="application/json+oembed"
|
||||
href="{{ oembed_absolute_uri }}?url={{ absolute_uri|urlencode }}&format=json"
|
||||
href="{{ oembed_absolute_uri }}?url={{ quoted_absolute_uri }}&format=json"
|
||||
title="{{ map.name }} oEmbed URL" />
|
||||
{% endblock extra_head %}
|
||||
{% block content %}
|
||||
|
|
|
@ -815,6 +815,6 @@ def test_oembed_link(client, map, datalayer):
|
|||
)
|
||||
assert (
|
||||
'href="http://testserver/map/oembed/'
|
||||
f'?url=http%3A//testserver/en/map/test-map_{map.id}&format=json"'
|
||||
f'?url=http%3A%2F%2Ftestserver%2Fen%2Fmap%2Ftest-map_{map.id}&format=json"'
|
||||
) in response.content.decode()
|
||||
assert 'title="test map oEmbed URL" />' in response.content.decode()
|
||||
|
|
|
@ -10,7 +10,7 @@ from http.client import InvalidURL
|
|||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
from urllib.error import HTTPError, URLError
|
||||
from urllib.parse import quote, urlparse
|
||||
from urllib.parse import quote, quote_plus, urlparse
|
||||
from urllib.request import Request, build_opener
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -595,8 +595,8 @@ class MapView(MapDetailMixin, PermissionsMixin, DetailView):
|
|||
context["oembed_absolute_uri"] = self.request.build_absolute_uri(
|
||||
reverse("map_oembed")
|
||||
)
|
||||
context["absolute_uri"] = self.request.build_absolute_uri(
|
||||
self.object.get_absolute_url()
|
||||
context["quoted_absolute_uri"] = quote_plus(
|
||||
self.request.build_absolute_uri(self.object.get_absolute_url())
|
||||
)
|
||||
return context
|
||||
|
||||
|
|
Loading…
Reference in a new issue