From f75fe3559d95e9572ba4d0c23c217e0fa6610c41 Mon Sep 17 00:00:00 2001 From: Song Gao Date: Mon, 6 Jul 2020 13:26:46 +0800 Subject: [PATCH] add hex decode --- server/api/region.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/api/region.go b/server/api/region.go index 085f943a3dba..64d02ab0f121 100644 --- a/server/api/region.go +++ b/server/api/region.go @@ -15,6 +15,7 @@ package api import ( "container/heap" + "encoding/hex" "fmt" "net/http" "net/url" @@ -583,7 +584,11 @@ func (h *regionsHandler) AccelerateRegionsScheduleInRange(w http.ResponseWriter, if !ok { return "", fmt.Errorf("bad format %s", name) } - return key, nil + returned, err := hex.DecodeString(key) + if err != nil { + return "", fmt.Errorf("split key %s is not in hex format", name) + } + return string(returned), nil } startKey, err := parseKey("start_key", input)