From c8555953a181163472fe4dfe29a7bf0d9a0c0162 Mon Sep 17 00:00:00 2001 From: Chen Chen <34592639+envestcc@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:08:40 +0800 Subject: [PATCH] [api] Fix parsing of log filter (#4376) --- api/web3server_utils.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/web3server_utils.go b/api/web3server_utils.go index 773eaff04e..392d966420 100644 --- a/api/web3server_utils.go +++ b/api/web3server_utils.go @@ -254,15 +254,15 @@ func parseLogRequest(in gjson.Result) (*filterObject, error) { logReq.Address = append(logReq.Address, addr.String()) } for _, topics := range req.Get("topics").Array() { + var topicArr []string if topics.IsArray() { - var topicArr []string for _, topic := range topics.Array() { topicArr = append(topicArr, util.Remove0xPrefix(topic.String())) } - logReq.Topics = append(logReq.Topics, topicArr) - } else { - logReq.Topics = append(logReq.Topics, []string{util.Remove0xPrefix(topics.String())}) + } else if str := topics.String(); str != "" { + topicArr = append(topicArr, util.Remove0xPrefix(str)) } + logReq.Topics = append(logReq.Topics, topicArr) } } return &logReq, nil