From bb2eab2968aa0d9065192d3101c9152f2ed80d57 2023-11-22 02:58:20 From: Ben Sturmfels Date: 2023-11-22 02:58:20 Subject: [PATCH] fossy: check UUID format in the URL routing to avoid unhandled exception Requests like /fossy/xyz123/ were causing an error due to "xyz123" not being a valid UUID. We should just return a 404 in this case, which the URL routing will now do automatically. --- diff --git a/conservancy/fossy/urls.py b/conservancy/fossy/urls.py index fbbabd19cac27bf1b6a10b36ece14c13fb73a1be..c567e81c681221d128f9dda657f34ab1e9b50ded 100644 --- a/conservancy/fossy/urls.py +++ b/conservancy/fossy/urls.py @@ -1,8 +1,8 @@ -from django.conf.urls import url +from django.urls import path from .views import CommunityTrackProposalCreateView, CommunityTrackProposalThanksView urlpatterns = [ - url(r'^community-tracks/$', CommunityTrackProposalCreateView.as_view(), name='fossy-add'), - url(r'^(?P[\w-]+)/$', CommunityTrackProposalThanksView.as_view(), name='fossy-thanks'), + path('community-tracks/', CommunityTrackProposalCreateView.as_view(), name='fossy-add'), + path('/', CommunityTrackProposalThanksView.as_view(), name='fossy-thanks'), ]