Support git remotes that use a IPV6 link-local address with a zone ID

Fixed 3 problems, and it seems to work now for both forms:

ssh://[fe80::7697:xxx:xxxx:xxxx%wlp3s0]/foo
fe80::7697:xxx:xxxx:xxxx%wlp3s0:foo
This commit is contained in:
Joey Hess 2025-04-02 15:11:54 -04:00
parent cb4cdaab75
commit ff520b06ac
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 20 additions and 6 deletions

View file

@ -103,9 +103,10 @@ parseRemoteLocation s knownurl repo = go
urlstyle v = isURI (escapeURIString isUnescapedInURI v)
-- git remotes can be written scp style -- [user@]host:dir
-- but foo::bar is a git-remote-helper location instead
-- (although '::' can also be part of an IPV6 address)
scpstyle v = ":" `isInfixOf` v
&& not ("//" `isInfixOf` v)
&& not ("::" `isInfixOf` v)
&& not ("::" `isInfixOf` (takeWhile (/= '[') v))
scptourl v = "ssh://" ++ host ++ slash dir
where
(host, dir)