release: repair the catalog 404 and stop the page jumping #3

Merged
Kessinen merged 6 commits from dev into main 2026-09-05 21:03:04 +00:00
2 changed files with 17 additions and 12 deletions
Showing only changes of commit f8b908b39e - Show all commits
+3 -3
View File
@@ -508,7 +508,7 @@ func (a *app) saveMain(w http.ResponseWriter, r *http.Request) {
log.Printf("save main: %v", err) log.Printf("save main: %v", err)
form.Err = "Tallennus epäonnistui." form.Err = "Tallennus epäonnistui."
default: default:
http.Redirect(w, r, "/ruoat", http.StatusSeeOther) http.Redirect(w, r, "/ruuat", http.StatusSeeOther)
return return
} }
} }
@@ -537,7 +537,7 @@ func (a *app) saveSide(w http.ResponseWriter, r *http.Request) {
log.Printf("save side: %v", err) log.Printf("save side: %v", err)
form.Err = "Tallennus epäonnistui." form.Err = "Tallennus epäonnistui."
default: default:
http.Redirect(w, r, "/ruoat", http.StatusSeeOther) http.Redirect(w, r, "/ruuat", http.StatusSeeOther)
return return
} }
} }
@@ -565,7 +565,7 @@ func (a *app) deleteDish(w http.ResponseWriter, r *http.Request) {
http.Error(w, "poisto epäonnistui", http.StatusInternalServerError) http.Error(w, "poisto epäonnistui", http.StatusInternalServerError)
return return
} }
http.Redirect(w, r, "/ruoat", http.StatusSeeOther) http.Redirect(w, r, "/ruuat", http.StatusSeeOther)
} }
// importDishes takes a bundle either pasted into the textarea or uploaded as a // importDishes takes a bundle either pasted into the textarea or uploaded as a
+14 -9
View File
@@ -220,9 +220,12 @@ check "the quick-added dish is on the board" \
# ---- catalog CRUD from the UI ------------------------------------------- # ---- catalog CRUD from the UI -------------------------------------------
check "adding a main redirects" \ # Assert where it redirects, not just that it does: these pointed at the old
"$(curl -s -o /dev/null -w '%{http_code}' -u ":$pass" \ # /ruoat spelling for a while and every 303-only check was happy.
-d 'nimi=uunikala&kategoria=fish&lisukkeita=1' "http://$addr/ruuat/paaruoka")" "303" check "adding a main redirects back to the catalog" \
"$(curl -s -o /dev/null -w '%{redirect_url}' -u ":$pass" \
-d 'nimi=uunikala&kategoria=fish&lisukkeita=1' "http://$addr/ruuat/paaruoka")" \
"/ruuat"
catalog=$(curl -s -u ":$pass" "http://$addr/ruuat") catalog=$(curl -s -u ":$pass" "http://$addr/ruuat")
check "the new main is listed, sentence-cased" "$catalog" "Uunikala" check "the new main is listed, sentence-cased" "$catalog" "Uunikala"
@@ -239,9 +242,10 @@ check "a nameless dish is refused" \
"$(curl -s -u ":$pass" -d 'nimi=+++&kategoria=fish' "http://$addr/ruuat/paaruoka")" \ "$(curl -s -u ":$pass" -d 'nimi=+++&kategoria=fish' "http://$addr/ruuat/paaruoka")" \
"Anna nimi." "Anna nimi."
check "adding a side redirects" \ check "adding a side redirects back to the catalog" \
"$(curl -s -o /dev/null -w '%{http_code}' -u ":$pass" \ "$(curl -s -o /dev/null -w '%{redirect_url}' -u ":$pass" \
-d 'nimi=lohkoperunat' "http://$addr/ruuat/lisuke")" "303" -d 'nimi=lohkoperunat' "http://$addr/ruuat/lisuke")" \
"/ruuat"
check "the new side is listed" \ check "the new side is listed" \
"$(curl -s -u ":$pass" "http://$addr/ruuat")" "Lohkoperunat" "$(curl -s -u ":$pass" "http://$addr/ruuat")" "Lohkoperunat"
@@ -264,9 +268,10 @@ check "the bin asks before deleting" \
check "the dish is still there while it asks" \ check "the dish is still there while it asks" \
"$(curl -s -u ":$pass" "http://$addr/ruuat?poista=$uusi&tyyppi=paa")" "Uunikala" "$(curl -s -u ":$pass" "http://$addr/ruuat?poista=$uusi&tyyppi=paa")" "Uunikala"
check "confirming the delete redirects" \ check "confirming the delete redirects back to the catalog" \
"$(curl -s -o /dev/null -w '%{http_code}' -u ":$pass" \ "$(curl -s -o /dev/null -w '%{redirect_url}' -u ":$pass" \
-d "id=$uusi&tyyppi=paa" "http://$addr/ruuat/poista")" "303" -d "id=$uusi&tyyppi=paa" "http://$addr/ruuat/poista")" \
"/ruuat"
refute "the dish is gone once confirmed" \ refute "the dish is gone once confirmed" \
"$(curl -s -u ":$pass" "http://$addr/ruuat")" "Uunikala" "$(curl -s -u ":$pass" "http://$addr/ruuat")" "Uunikala"