Fixed url escaping for good ;)

merge-requests/552/head
Eliot Berriot 2018-12-19 16:45:40 +01:00
rodzic d7ea78d2bf
commit e8b2b94df4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
2 zmienionych plików z 11 dodań i 6 usunięć

Wyświetl plik

@ -1,3 +1,5 @@
import urllib.parse
from django.conf import settings
from django.urls import reverse
@ -58,6 +60,7 @@ def library_track(request, pk):
"content": utils.join_url(settings.FUNKWHALE_URL, obj.listen_url),
}
)
metas.append(
{
"tag": "link",
@ -65,7 +68,7 @@ def library_track(request, pk):
"type": "application/json+oembed",
"href": (
utils.join_url(settings.FUNKWHALE_URL, reverse("api:v1:oembed"))
+ "?url={}&format=json".format(track_url)
+ "?format=json&url={}".format(urllib.parse.quote_plus(track_url))
),
}
)
@ -124,7 +127,7 @@ def library_album(request, pk):
"type": "application/json+oembed",
"href": (
utils.join_url(settings.FUNKWHALE_URL, reverse("api:v1:oembed"))
+ "?url={}&format=json".format(album_url)
+ "?format=json&url={}".format(urllib.parse.quote_plus(album_url))
),
}
)

Wyświetl plik

@ -1,3 +1,5 @@
import urllib.parse
from django.urls import reverse
from funkwhale_api.common import utils
@ -61,8 +63,8 @@ def test_library_track(spa_html, no_api_auth, client, factories, settings):
"type": "application/json+oembed",
"href": (
utils.join_url(settings.FUNKWHALE_URL, reverse("api:v1:oembed"))
+ "?url={}&format=json".format(
utils.join_url(settings.FUNKWHALE_URL, url)
+ "?format=json&url={}".format(
urllib.parse.quote_plus(utils.join_url(settings.FUNKWHALE_URL, url))
)
),
},
@ -115,8 +117,8 @@ def test_library_album(spa_html, no_api_auth, client, factories, settings):
"type": "application/json+oembed",
"href": (
utils.join_url(settings.FUNKWHALE_URL, reverse("api:v1:oembed"))
+ "?url={}&format=json".format(
utils.join_url(settings.FUNKWHALE_URL, url)
+ "?format=json&url={}".format(
urllib.parse.quote_plus(utils.join_url(settings.FUNKWHALE_URL, url))
)
),
},