From 1f3be808830ae8e81d2501505102645d609029fa Mon Sep 17 00:00:00 2001 From: Matt Frazier Date: Thu, 19 Dec 2024 05:35:33 -0500 Subject: [PATCH] Avoid superfluous PrivateLink query --- website/routes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/website/routes.py b/website/routes.py index 61d6c96c9aa..2acd71db1a6 100644 --- a/website/routes.py +++ b/website/routes.py @@ -176,8 +176,11 @@ def get_globals(): def is_private_link_anonymous_view(): # Avoid circular import from osf.models import PrivateLink + view_only = request.args.get('view_only') + if not view_only: + return False try: - return PrivateLink.objects.filter(key=request.args.get('view_only')).values_list('anonymous', flat=True).get() + return PrivateLink.objects.filter(key=view_only).values_list('anonymous', flat=True).get() except PrivateLink.DoesNotExist: return False