Merge pull request #118 from fiatjaf/fix/event-split-safety

fix: use strings.Cut instead of strings.Split to avoid potential panic
This commit is contained in:
mattn
2026-03-30 14:10:25 +09:00
committed by GitHub

View File

@@ -354,7 +354,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, " ") + " ]? ") {