mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-26 09:11:00 +00:00
Don't error when no resource on webfinger
This commit is contained in:
parent
cfae183e80
commit
8d56f8388f
1 changed files with 4 additions and 2 deletions
|
@ -2,7 +2,7 @@ import json
|
||||||
|
|
||||||
from asgiref.sync import async_to_sync
|
from asgiref.sync import async_to_sync
|
||||||
from django.conf import settings
|
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.utils.decorators import method_decorator
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.generic import View
|
from django.views.generic import View
|
||||||
|
@ -94,8 +94,10 @@ class Webfinger(View):
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
resource = request.GET.get("resource")
|
resource = request.GET.get("resource")
|
||||||
|
if not resource:
|
||||||
|
return HttpResponseBadRequest("No resource specified")
|
||||||
if not resource.startswith("acct:"):
|
if not resource.startswith("acct:"):
|
||||||
raise Http404("Not an account resource")
|
return HttpResponseBadRequest("Not an account resource")
|
||||||
handle = resource[5:]
|
handle = resource[5:]
|
||||||
if handle.startswith("__system__@"):
|
if handle.startswith("__system__@"):
|
||||||
# They are trying to webfinger the system actor
|
# They are trying to webfinger the system actor
|
||||||
|
|
Loading…
Reference in a new issue