diff --git a/bookwyrm/tests/views/test_wellknown.py b/bookwyrm/tests/views/test_wellknown.py index 4a3eb579f..fcbcc12b7 100644 --- a/bookwyrm/tests/views/test_wellknown.py +++ b/bookwyrm/tests/views/test_wellknown.py @@ -51,6 +51,16 @@ class UserViews(TestCase): data = json.loads(result.getvalue()) self.assertEqual(data["subject"], "acct:mouse@local.com") + def test_webfinger_case_sensitivty(self): + """ensure that webfinger queries are not case sensitive""" + request = self.factory.get("", {"resource": "acct:MoUsE@local.com"}) + request.user = self.anonymous_user + + result = views.webfinger(request) + self.assertIsInstance(result, JsonResponse) + data = json.loads(result.getvalue()) + self.assertEqual(data["subject"], "acct:mouse@local.com") + def test_nodeinfo_pointer(self): """just tells you where nodeinfo is""" request = self.factory.get("") diff --git a/bookwyrm/views/wellknown.py b/bookwyrm/views/wellknown.py index 2462c5a49..9c76beafa 100644 --- a/bookwyrm/views/wellknown.py +++ b/bookwyrm/views/wellknown.py @@ -20,7 +20,7 @@ def webfinger(request): username = resource.replace("acct:", "") try: - user = models.User.objects.get(username=username) + user = models.User.objects.get(username__iexact=username) except models.User.DoesNotExist: return HttpResponseNotFound("No account found")