Redirect to /xd42/meta after upload #52

Manually merged
electricdusk merged 1 commits from redirect-meta into master 2020-05-11 22:32:58 +02:00

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,