Introduce a commercial license option alongside AGPL-3.0-only, require a CLA for contributors, and document the terms in COMMERCIAL.md and NOTICE. Add a script to stamp SPDX headers on Go files and apply it across the tree.
30 lines
1.0 KiB
Go
30 lines
1.0 KiB
Go
// 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
|
|
}
|