kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Merge branch 'patch-1' into 'develop'
Handle invalid JSON returned by nodeinfo endpoint Closes #1057 See merge request funkwhale/funkwhale!1201environments/review-docs-devel-1399dq/deployments/6607
commit
cda1406ad0
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
|
@ -18,6 +19,9 @@ from . import nodeinfo
|
|||
NODEINFO_2_CONTENT_TYPE = "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8" # noqa
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AdminSettings(preferences_viewsets.GlobalPreferencesViewSet):
|
||||
pagination_class = None
|
||||
permission_classes = [oauth_permissions.ScopePermission]
|
||||
|
@ -44,7 +48,11 @@ class NodeInfo(views.APIView):
|
|||
authentication_classes = []
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
data = nodeinfo.get()
|
||||
try:
|
||||
data = nodeinfo.get()
|
||||
except ValueError:
|
||||
logger.warn("nodeinfo returned invalid json")
|
||||
data = {}
|
||||
return Response(data, status=200, content_type=NODEINFO_2_CONTENT_TYPE)
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue