fix
All checks were successful
Build and Publish / Metadata (push) Successful in 10s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m25s
Build and Publish / BuildAndDeployArm64 (push) Successful in 3m53s

This commit is contained in:
matst80
2025-10-15 09:35:35 +02:00
parent 21fd5c8446
commit a5d61ce56f

View File

@@ -153,19 +153,8 @@ func (fs *FileServer) CartHandler(w http.ResponseWriter, r *http.Request) {
path := filepath.Join(fs.dataDir, fmt.Sprintf("%d.events.log", id)) path := filepath.Join(fs.dataDir, fmt.Sprintf("%d.events.log", id))
info, err := os.Stat(path) info, err := os.Stat(path)
if err != nil && errors.Is(err, os.ErrNotExist) { if err != nil && errors.Is(err, os.ErrNotExist) {
// try brace-wrapped filename as fallback
alt := filepath.Join(fs.dataDir, fmt.Sprintf("{%d}.events.log", id))
if fi, err2 := os.Stat(alt); err2 == nil {
path = alt
info = fi
} else {
if errors.Is(err2, os.ErrNotExist) {
writeJSON(w, http.StatusNotFound, map[string]string{"error": "cart not found"}) writeJSON(w, http.StatusNotFound, map[string]string{"error": "cart not found"})
return return
}
writeJSON(w, http.StatusInternalServerError, map[string]string{"error": err2.Error()})
return
}
} else if err != nil { } else if err != nil {
writeJSON(w, http.StatusInternalServerError, map[string]string{"error": err.Error()}) writeJSON(w, http.StatusInternalServerError, map[string]string{"error": err.Error()})
return return