From 3d650ee50298100f0974fb4ba4d2426cc41bfbeb Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Mon, 30 Mar 2026 13:43:29 +0900 Subject: [PATCH] fix: use strings.Cut instead of strings.Split to avoid potential panic strings.Split(url, "://")[1] panics if the URL has no "://" separator. strings.Cut handles this safely by returning an empty string. --- event.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/event.go b/event.go index fc4e037..38235d5 100644 --- a/event.go +++ b/event.go @@ -340,7 +340,8 @@ func publishFlow(ctx context.Context, c *cli.Command, kr nostr.Signer, evt nostr if c.Bool("confirm") { relaysStr := make([]string, len(relays)) for i, r := range relays { - relaysStr[i] = strings.ToLower(strings.Split(r.URL, "://")[1]) + _, after, _ := strings.Cut(r.URL, "://") + relaysStr[i] = strings.ToLower(after) } time.Sleep(time.Millisecond * 10) if !askConfirmation("publish to [ " + strings.Join(relaysStr, " ") + " ]? ") {