mirror of
https://github.com/fiatjaf/nak.git
synced 2026-08-11 00:17:35 +00:00
Merge pull request #167 from mattn/fix/grasp-host-panic
git: don't panic in graspServerHost on empty or unparseable URLs
This commit is contained in:
@@ -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]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user