From 10a9c0bc1b6287d69e13126a85708322a26e0bef Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 11 Mar 2024 19:01:55 +0000 Subject: Handles negative id --- cmd/api/datamaps.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/api/datamaps.go b/cmd/api/datamaps.go index 53f08bf..517d82d 100644 --- a/cmd/api/datamaps.go +++ b/cmd/api/datamaps.go @@ -14,8 +14,7 @@ func (app *application) showDatamapHandler(w http.ResponseWriter, r *http.Reques id := r.PathValue("id") app.logger.Info("the id requested", "id", id) id_int, err := strconv.ParseInt(id, 10, 64) - // TODO: Handle negative integers passed in the URL here - if err != nil { + if err != nil || id_int < 1 { http.NotFound(w, r) return } -- cgit v1.2.3