From 078d9895a2bf5691f5a2c7417397c33b480b57a7 Mon Sep 17 00:00:00 2001 From: Lukas SP Date: Fri, 2 Oct 2020 18:25:39 +0200 Subject: [PATCH] Prevent from sending deletion token hash --- internal/pastes/paste.go | 2 +- internal/web/controllers/v1/pastes.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/pastes/paste.go b/internal/pastes/paste.go index 9f83034..4b3a08a 100644 --- a/internal/pastes/paste.go +++ b/internal/pastes/paste.go @@ -11,7 +11,7 @@ type Paste struct { ID string `json:"id" bson:"_id"` Content string `json:"content" bson:"content"` SuggestedSyntaxType string `json:"suggestedSyntaxType" bson:"suggestedSyntaxType"` - DeletionToken string `json:"deletionToken" bson:"deletionToken"` + DeletionToken string `json:"deletionToken" bson:"deletionToken,omitempty"` Created int64 `json:"created" bson:"created"` AutoDelete bool `json:"autoDelete" bson:"autoDelete"` } diff --git a/internal/web/controllers/v1/pastes.go b/internal/web/controllers/v1/pastes.go index f8f7171..ed25f10 100644 --- a/internal/web/controllers/v1/pastes.go +++ b/internal/web/controllers/v1/pastes.go @@ -33,6 +33,7 @@ func v1GetPaste(ctx *fasthttp.RequestCtx) { ctx.SetBodyString("paste not found") return } + paste.DeletionToken = "" // Respond with the paste jsonData, err := json.Marshal(paste)