From 324a8393abc0dd144824d6d9073232448138d62f Mon Sep 17 00:00:00 2001 From: dogboat Date: Mon, 2 Mar 2026 07:57:21 -0500 Subject: [PATCH 1/2] helpful error message rather than crash when trying to view non-URL in URL view --- dojo/url/ui/views.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dojo/url/ui/views.py b/dojo/url/ui/views.py index a879867ea75..dffca054b67 100644 --- a/dojo/url/ui/views.py +++ b/dojo/url/ui/views.py @@ -8,7 +8,7 @@ from django.core.exceptions import PermissionDenied, ValidationError from django.core.management import call_command from django.db import DEFAULT_DB_ALIAS -from django.http import HttpRequest, HttpResponseRedirect +from django.http import Http404, HttpRequest, HttpResponseRedirect from django.shortcuts import get_object_or_404, render from django.urls import reverse from django.utils import timezone @@ -100,6 +100,14 @@ def process_endpoint_view(request: HttpRequest, location_id: int, *, host_view=F """ location = get_object_or_404(Location, id=location_id) + if location.location_type != URL.get_location_type(): + messages.add_message( + request, + messages.ERROR, + "Viewing this object is only available in the Pro new UI.", + extra_tags="alert-danger", + ) + raise Http404 host = location.url.host locations = None metadata = None From 03562afddfc97e81498ec1f20569ffb1d70bfec7 Mon Sep 17 00:00:00 2001 From: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> Date: Mon, 2 Mar 2026 09:01:31 -0700 Subject: [PATCH 2/2] Update dojo/url/ui/views.py --- dojo/url/ui/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dojo/url/ui/views.py b/dojo/url/ui/views.py index dffca054b67..773fc6e9141 100644 --- a/dojo/url/ui/views.py +++ b/dojo/url/ui/views.py @@ -104,7 +104,7 @@ def process_endpoint_view(request: HttpRequest, location_id: int, *, host_view=F messages.add_message( request, messages.ERROR, - "Viewing this object is only available in the Pro new UI.", + "Viewing this object is only available in the Pro UI.", extra_tags="alert-danger", ) raise Http404