change ids
All checks were successful
Build and Publish / Metadata (push) Successful in 3s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 50s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m25s

This commit is contained in:
matst80
2025-10-10 21:50:18 +00:00
parent b0e6c8eca8
commit e48a2590bd
13 changed files with 312 additions and 510 deletions

View File

@@ -156,9 +156,12 @@ func OwnershipProxyMiddleware(pool *SyncedPool) func(http.Handler) http.Handler
func extractCartIdFromRequest(r *http.Request) (CartId, bool) {
// Cookie
if c, err := r.Cookie("cartid"); err == nil && c.Value != "" {
if cid, _, _, err2 := CanonicalizeOrLegacy(c.Value); err2 == nil {
return CartIDToLegacy(cid), true
if parsed, ok := ParseCartId(c.Value); ok {
return parsed, true
}
// Invalid existing cookie value: issue a fresh id (breaking change behavior)
newId := MustNewCartId()
return newId, true
}
// Path-based: locate "byid" segment
parts := splitPath(r.URL.Path)
@@ -166,8 +169,8 @@ func extractCartIdFromRequest(r *http.Request) (CartId, bool) {
if parts[i] == "byid" && i+1 < len(parts) {
raw := parts[i+1]
if raw != "" {
if cid, _, _, err := CanonicalizeOrLegacy(raw); err == nil {
return CartIDToLegacy(cid), true
if parsed, ok := ParseCartId(raw); ok {
return parsed, true
}
}
}