Manage /<hex-id> paths

Fix 211628b6
This commit is contained in:
Daniele Tonon
2023-11-10 23:07:13 +01:00
parent bf182d1a68
commit fa61e7394e

View File

@@ -61,6 +61,13 @@ func renderEvent(w http.ResponseWriter, r *http.Request) {
data, err := grabData(r.Context(), code, false)
if err != nil {
code, errTry := nip19.EncodeEvent(r.URL.Path[1:], []string{}, "")
if errTry == nil {
http.Redirect(w, r, "/"+code, http.StatusFound)
return
}
w.Header().Set("Cache-Control", "max-age=60")
errorPage := &ErrorPage{
Errors: err.Error(),