Browse Source

Added normal 404 handling for URLs which doen't exist

dependabot/npm_and_yarn/web/prismjs-1.21.0
Max Schmitt 8 years ago
parent
commit
d12032ed72
  1. 4
      handlers/handlers.go

4
handlers/handlers.go

@ -200,7 +200,9 @@ func (h *Handler) handleAccess(c *gin.Context) {
id = c.Request.URL.Path[1:] id = c.Request.URL.Path[1:]
} }
entry, err := h.store.GetEntryByID(id) entry, err := h.store.GetEntryByID(id)
if err != nil { if err == store.ErrIDIsEmpty || err == store.ErrNoEntryFound {
return // return normal 404 error if such an error occurs
} else if err != nil {
c.JSON(http.StatusNotFound, gin.H{"error": err.Error()}) c.JSON(http.StatusNotFound, gin.H{"error": err.Error()})
return return
} }

Loading…
Cancel
Save