From 5aebb242f81a46c8a91f8ba3bc1604728bc59c2d Mon Sep 17 00:00:00 2001 From: Alan Bernstein Date: Wed, 8 Apr 2020 22:58:45 -0500 Subject: [PATCH] Fix off-by-one error --- http/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http/handler.go b/http/handler.go index 65028f1ee..6789ace66 100644 --- a/http/handler.go +++ b/http/handler.go @@ -218,7 +218,7 @@ const ( func (h *Handler) addQueryContext(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { pathParts := strings.Split(r.URL.Path, "/") - if len(pathParts) >= 3 && pathParts[3] == "query" { + if len(pathParts) > 3 && pathParts[3] == "query" { req, err := h.readQueryRequest(r) ctx := context.WithValue(r.Context(), contextKeyQueryRequest, req) ctx = context.WithValue(ctx, contextKeyQueryError, err)