git: don't panic in graspServerHost when the server URL is empty or unparseable.

This commit is contained in:
Yasuhiro Matsumoto
2026-07-15 14:22:31 +09:00
parent fd8fdad26a
commit d419b35b66
+6 -1
View File
@@ -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]
}