forked from electricdusk/rushlink
Only provide deleteToken if requested by user
This commit is contained in:
parent
f45c132b41
commit
f36ed4a4c7
@ -9,6 +9,9 @@ the command line.
|
||||
## USAGE
|
||||
|
||||
# Shorten a URL
|
||||
curl -F'shorten=http://example.com/some/long/url' <a href="https://hashru.link">https://hashru.link</a>
|
||||
curl -F'shorten=http://example.com/some/long/url' <a href="{{Request.Host}}">{{Request.Host}}</a>
|
||||
|
||||
# Shorten a URL with a token to delete it later
|
||||
curl -F'shorten=http://example.com/some/long/url' -F'deleteToken=' <a href="{{Request.Host}}">{{Request.Host}}</a>
|
||||
</pre>
|
||||
{{end}}
|
@ -7,4 +7,7 @@ the command line.
|
||||
## USAGE
|
||||
|
||||
# Shorten a URL
|
||||
curl -F'shorten=http://example.com/some/long/url' https://hashru.link
|
||||
curl -F'shorten=http://example.com/some/long/url' {{Request.Host}}
|
||||
|
||||
# Shorten a URL with a token to delete it later
|
||||
curl -F'shorten=http://example.com/some/long/url' -F'deleteToken=' {{Request.Host}}
|
@ -1 +1,5 @@
|
||||
{{.Request.Host}}/{{.Paste.Key}}?deleteToken={{.Paste.DeleteToken}}
|
||||
{{- if .Request.PostForm.deleteToken -}}
|
||||
{{.Request.Host}}/{{.Paste.Key}}?deleteToken={{.Paste.DeleteToken | urlquery}}
|
||||
{{else -}}
|
||||
{{.Request.Host}}/{{.Paste.Key}}
|
||||
{{end -}}
|
||||
|
@ -227,7 +227,6 @@ func newRedirectPasteHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Delete a URL from the database
|
||||
func deletePasteHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO(dsprenkels) LEFT HERE; this functionality still untested
|
||||
vars := mux.Vars(r)
|
||||
key := vars["key"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user