fix(urls): move static-prefix routes before dynamic <str:uid>/ pattern
All checks were successful
CVE Scan & Docker Build / security-scan (push) Successful in 52s
CVE Scan & Docker Build / build-and-push (push) Successful in 2m14s

Relocate `search/`, `concepts/`, and `concepts/<str:uid>/` URL patterns
to appear before the `<str:uid>/` catch-all route, preventing Django
from incorrectly matching those static prefixes as library UIDs.
This commit is contained in:
2026-05-08 06:28:04 -04:00
parent 027de096bc
commit 3c7f85cba0

View File

@@ -17,6 +17,12 @@ urlpatterns = [
# Library CRUD # Library CRUD
path("", views.library_list, name="library-list"), path("", views.library_list, name="library-list"),
path("create/", views.library_create, name="library-create"), path("create/", views.library_create, name="library-create"),
# Static-prefix routes must come before <str:uid>/ or it will swallow them.
# Search (Phase 3)
path("search/", views.search_page, name="search"),
# Concepts (Phase 3)
path("concepts/", views.concept_list_page, name="concept-list"),
path("concepts/<str:uid>/", views.concept_detail_page, name="concept-detail"),
path("<str:uid>/", views.library_detail, name="library-detail"), path("<str:uid>/", views.library_detail, name="library-detail"),
path("<str:uid>/search/", views.library_search, name="library-search"), path("<str:uid>/search/", views.library_search, name="library-search"),
path("<str:uid>/edit/", views.library_edit, name="library-edit"), path("<str:uid>/edit/", views.library_edit, name="library-edit"),
@@ -55,11 +61,6 @@ urlpatterns = [
path("items/<str:uid>/delete/", views.item_delete, name="item-delete"), path("items/<str:uid>/delete/", views.item_delete, name="item-delete"),
# Image views # Image views
path("images/<str:uid>/view/", views.image_serve, name="image-serve"), path("images/<str:uid>/view/", views.image_serve, name="image-serve"),
# Search (Phase 3)
path("search/", views.search_page, name="search"),
# Concepts (Phase 3)
path("concepts/", views.concept_list_page, name="concept-list"),
path("concepts/<str:uid>/", views.concept_detail_page, name="concept-detail"),
# DRF API # DRF API
path("api/", include("library.api.urls")), path("api/", include("library.api.urls")),
] ]