Changeset - bb2eab2968aa
[Not reviewed]
0 1 0
Ben Sturmfels (bsturmfels) - 5 months ago 2023-11-22 02:58:20
ben@sturm.com.au
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.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
conservancy/fossy/urls.py
Show inline comments
 
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<pk>[\w-]+)/$', CommunityTrackProposalThanksView.as_view(), name='fossy-thanks'),
 
    path('community-tracks/', CommunityTrackProposalCreateView.as_view(), name='fossy-add'),
 
    path('<uuid:pk>/', CommunityTrackProposalThanksView.as_view(), name='fossy-thanks'),
 
]
0 comments (0 inline, 0 general)