Do not consider edit mode as a history entry

This commit is contained in:
2026-07-20 17:31:59 +02:00
parent 34f750beff
commit 28d22c040f
6 changed files with 93 additions and 2 deletions
+9
View File
@@ -465,6 +465,15 @@ func (h *handler) handlePost(w http.ResponseWriter, r *http.Request, urlPath, fs
}
}
}
// The editor saves via fetch so the save and its result share one history
// entry (see assets/history-nav.js). Hand it the target instead of a 303:
// the browser would follow the redirect into a second entry, and fetch
// drops the #section fragment from a followed redirect anyway.
if r.Header.Get("X-Save-Mode") == "replace" {
w.Header().Set("X-Target", redirectTarget)
w.WriteHeader(http.StatusNoContent)
return
}
http.Redirect(w, r, redirectTarget, http.StatusSeeOther)
}