From 86b4fbdd961ab2417db5655b7818f00ddd5dff0e Mon Sep 17 00:00:00 2001 From: moul <94029+moul@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:12:06 -0500 Subject: [PATCH] chore: fixup Signed-off-by: moul <94029+moul@users.noreply.github.com> --- tm2/pkg/sdk/params/handler.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tm2/pkg/sdk/params/handler.go b/tm2/pkg/sdk/params/handler.go index 907482db420..b662fc06c58 100644 --- a/tm2/pkg/sdk/params/handler.go +++ b/tm2/pkg/sdk/params/handler.go @@ -64,7 +64,7 @@ func abciResult(err error) sdk.Result { // returns the second component of a path. func secondPart(path string) string { - parts := strings.Split(path, "/") + parts := strings.SplitN(path, "/", 3) if len(parts) < 2 { return "" } else { @@ -74,9 +74,6 @@ func secondPart(path string) string { // returns the third component of a path, including other slashes. func thirdPartWithSlashes(path string) string { - secondSlash := strings.Index(path[strings.Index(path, "/")+1:], "/") - if secondSlash == -1 { - return "" // Return original if less than two slashes - } - return path[strings.Index(path, "/")+secondSlash+2:] + split := strings.SplitN(path, "/", 3) + return split[2] }