diff --git a/lib/admin.go b/lib/admin.go index ac1a31e..67fa00b 100644 --- a/lib/admin.go +++ b/lib/admin.go @@ -47,7 +47,7 @@ func deleteHandler(h handler) { } h.sess.Save(h.w, h.r) if isNew { - http.Redirect(h.w, h.r, "/new/", http.StatusFound) + http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound) } else { http.Redirect(h.w, h.r, "/", http.StatusFound) } @@ -117,6 +117,7 @@ func saveHandler(h handler) { if h.db.IsBookActive(id) { http.Redirect(h.w, h.r, "/book/"+id, http.StatusFound) } else { + // XXX: I can't use a referer here :( http.Redirect(h.w, h.r, "/new/", http.StatusFound) } } @@ -216,5 +217,5 @@ func storeHandler(h handler) { h.sess.Notify("Store books!", "The books '"+strings.Join(titles, ", ")+"' are stored for public download", "success") } h.sess.Save(h.w, h.r) - http.Redirect(h.w, h.r, "/new/", http.StatusFound) + http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound) }