1
0
mirror of https://github.com/lus/pasty.git synced 2023-08-10 21:13:09 +03:00

Implement deletion token hashing

This commit is contained in:
Lukas SP 2020-08-23 16:06:40 +02:00
parent 0fc4ada144
commit cc150b82ac

View File

@ -75,6 +75,15 @@ func v1PostPaste(ctx *fasthttp.RequestCtx) {
return
}
// Hash the deletion token
pasteCopy := *paste
err = paste.HashDeletionToken()
if err != nil {
ctx.SetStatusCode(fasthttp.StatusInternalServerError)
ctx.SetBodyString(err.Error())
return
}
// Save the paste
err = storage.Current.Save(paste)
if err != nil {
@ -84,7 +93,7 @@ func v1PostPaste(ctx *fasthttp.RequestCtx) {
}
// Respond with the paste
jsonData, err := json.Marshal(paste)
jsonData, err := json.Marshal(pasteCopy)
if err != nil {
ctx.SetStatusCode(fasthttp.StatusInternalServerError)
ctx.SetBodyString(err.Error())