Redirect to /xd42/meta after upload

Fixes #51
This commit is contained in:
Daan Sprenkels 2020-05-09 00:43:07 +02:00
parent a0c8383555
commit b7ea5dfa4f

View File

@ -198,6 +198,13 @@ func (rl *rushlink) viewCreateSuccess(w http.ResponseWriter, r *http.Request, p
if fu != nil { if fu != nil {
fileExt = fu.Ext() fileExt = fu.Ext()
} }
// Redirect to the new paste.
pasteURL := url.URL{
Path: fmt.Sprintf("/%s%s/meta", p.Key, fileExt),
RawQuery: fmt.Sprintf("deleteToken=%s", url.QueryEscape(p.DeleteToken)),
}
http.Redirect(w, r, pasteURL.String(), http.StatusFound)
// But still render the page for CURL-like clients.
data := map[string]interface{}{ data := map[string]interface{}{
"Paste": p, "Paste": p,
"FileExt": fileExt, "FileExt": fileExt,