From d419b35b660802dcea02d5fc927296fc78f93032 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Wed, 15 Jul 2026 09:10:01 +0900 Subject: [PATCH] git: don't panic in graspServerHost when the server URL is empty or unparseable. --- git.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git.go b/git.go index 0998851..8741388 100644 --- a/git.go +++ b/git.go @@ -2871,5 +2871,10 @@ func rebuildGraspURLFromRemote(remoteName string) string { } func graspServerHost(s string) string { - return strings.SplitN(nostr.NormalizeURL(s), "/", 3)[2] + // NormalizeURL returns "" for empty or unparseable inputs + parts := strings.SplitN(nostr.NormalizeURL(s), "/", 3) + if len(parts) < 3 { + return "" + } + return parts[2] }