From 8d56f8388ff58680a9419e55669778c22e5c9460 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Mon, 21 Nov 2022 08:34:02 -0700 Subject: Don't error when no resource on webfinger --- users/views/activitypub.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/users/views/activitypub.py b/users/views/activitypub.py index bb52f8a..0ba7d67 100644 --- a/users/views/activitypub.py +++ b/users/views/activitypub.py @@ -2,7 +2,7 @@ import json from asgiref.sync import async_to_sync from django.conf import settings -from django.http import Http404, HttpResponse, HttpResponseBadRequest, JsonResponse +from django.http import HttpResponse, HttpResponseBadRequest, JsonResponse from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt from django.views.generic import View @@ -94,8 +94,10 @@ class Webfinger(View): def get(self, request): resource = request.GET.get("resource") + if not resource: + return HttpResponseBadRequest("No resource specified") if not resource.startswith("acct:"): - raise Http404("Not an account resource") + return HttpResponseBadRequest("Not an account resource") handle = resource[5:] if handle.startswith("__system__@"): # They are trying to webfinger the system actor -- cgit v1.2.3