kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Fixed crashing nodeinfo fetching when remote answers with invalid JSON
rodzic
62939d6826
commit
d39edae061
|
@ -190,7 +190,7 @@ def update_domain_nodeinfo(domain):
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
try:
|
try:
|
||||||
nodeinfo = {"status": "ok", "payload": fetch_nodeinfo(domain.name)}
|
nodeinfo = {"status": "ok", "payload": fetch_nodeinfo(domain.name)}
|
||||||
except (requests.RequestException, serializers.serializers.ValidationError) as e:
|
except (requests.RequestException, serializers.serializers.ValidationError, ValueError) as e:
|
||||||
nodeinfo = {"status": "error", "error": str(e)}
|
nodeinfo = {"status": "error", "error": str(e)}
|
||||||
|
|
||||||
service_actor_id = common_utils.recursive_getattr(
|
service_actor_id = common_utils.recursive_getattr(
|
||||||
|
|
|
@ -371,7 +371,7 @@ class ManageDomainViewSet(
|
||||||
|
|
||||||
def perform_create(self, serializer):
|
def perform_create(self, serializer):
|
||||||
domain = serializer.save()
|
domain = serializer.save()
|
||||||
federation_tasks.update_domain_nodeinfo.delay(domain_name=domain.name)
|
federation_tasks.update_domain_nodeinfo(domain_name=domain.name)
|
||||||
|
|
||||||
@rest_decorators.action(methods=["get"], detail=True)
|
@rest_decorators.action(methods=["get"], detail=True)
|
||||||
def nodeinfo(self, request, *args, **kwargs):
|
def nodeinfo(self, request, *args, **kwargs):
|
||||||
|
|
|
@ -63,7 +63,7 @@ def test_domain_detail(factories, superuser_api_client):
|
||||||
|
|
||||||
def test_domain_create(superuser_api_client, mocker):
|
def test_domain_create(superuser_api_client, mocker):
|
||||||
update_domain_nodeinfo = mocker.patch(
|
update_domain_nodeinfo = mocker.patch(
|
||||||
"funkwhale_api.federation.tasks.update_domain_nodeinfo.delay"
|
"funkwhale_api.federation.tasks.update_domain_nodeinfo"
|
||||||
)
|
)
|
||||||
url = reverse("api:v1:manage:federation:domains-list")
|
url = reverse("api:v1:manage:federation:domains-list")
|
||||||
response = superuser_api_client.post(url, {"name": "test.federation"})
|
response = superuser_api_client.post(url, {"name": "test.federation"})
|
||||||
|
|
Ładowanie…
Reference in New Issue