diff options
author | Andrew Godwin | 2022-11-21 08:34:02 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-21 14:34:03 -0700 |
commit | 8d56f8388ff58680a9419e55669778c22e5c9460 (patch) | |
tree | 185e9508d401a23f12cdf87accc8e7673c22898a | |
parent | cfae183e80c2147c65d09cf56f5cbe51fc574feb (diff) | |
download | takahe-8d56f8388ff58680a9419e55669778c22e5c9460.tar.gz takahe-8d56f8388ff58680a9419e55669778c22e5c9460.tar.bz2 takahe-8d56f8388ff58680a9419e55669778c22e5c9460.zip |
Don't error when no resource on webfinger
-rw-r--r-- | users/views/activitypub.py | 6 |
1 files 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 |