diff options
Diffstat (limited to 'backend/api')
| -rw-r--r-- | backend/api/routes.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/backend/api/routes.go b/backend/api/routes.go index ff43714..474fdda 100644 --- a/backend/api/routes.go +++ b/backend/api/routes.go @@ -3,6 +3,7 @@ package api import ( "encoding/json" "fmt" + "github.com/jackyzha0/ctrl-v/security" "net/http" "time" @@ -87,6 +88,13 @@ func handleGetPaste(w http.ResponseWriter, r *http.Request, parsedPassword strin return } + // if internal error with encryption + if err == security.EncryptionError { + w.WriteHeader(http.StatusInternalServerError) + fmt.Fprintf(w, "%s", err) + return + } + // otherwise, return paste content, title, and current time w.Header().Set("Content-Type", "application/json") pasteMap := map[string]interface{}{ |