// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial // SPDX-FileCopyrightText: 2025-2026 Christian Galo package server import ( "net/http" "github.com/google/uuid" ) // pathUUID reads a UUID path value and answers a typo with the operator // not-found page instead of a database error. Every record page lives under // a list's prefix (/operator/products/{productID} and its siblings), so any // path segment that is not a UUID is a page that does not exist, not a // lookup that failed: /operator/plan-ladders/validation after that page was // retired, or a hand-edited address. Returning 500 for those mislabelled a // missing page as a server fault (found in the acceptance-fixes round-2 // page pass, 2026-09-03). The returned string is the canonical lower-case // form of the id. func (h *OperatorPartialsHandler) pathUUID(w http.ResponseWriter, r *http.Request, name string) (string, bool) { raw := r.PathValue(name) id, err := uuid.Parse(raw) if err != nil { h.GetOperatorNotFound(w, r) return "", false } return id.String(), true }