From c021b873d5bacb31b5a768ef8ad78ce33c5e332e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Podg=C3=B3rski?= Date: Fri, 9 Apr 2021 13:34:14 +0200 Subject: [PATCH] Fix panic on field not found on /import --- http/handler.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/http/handler.go b/http/handler.go index 426484b3b..b6824ab85 100644 --- a/http/handler.go +++ b/http/handler.go @@ -2372,8 +2372,8 @@ func (h *Handler) handlePostImportAtomicRecord(w http.ResponseWriter, r *http.Re // handlePostImport handles /import requests. func (h *Handler) handlePostImport(w http.ResponseWriter, r *http.Request) { // Verify that request is only communicating over protobufs. - if error, code := validateProtobufHeader(r); error != "" { - http.Error(w, error, code) + if err, code := validateProtobufHeader(r); err != "" { + http.Error(w, err, code) return } @@ -2392,7 +2392,7 @@ func (h *Handler) handlePostImport(w http.ResponseWriter, r *http.Request) { fieldName := mux.Vars(r)["field"] field := index.Field(fieldName) if field == nil { - http.Error(w, err.Error(), http.StatusNotFound) + http.Error(w, pilosa.ErrFieldNotFound.Error(), http.StatusNotFound) return }