URL decoding for username and path
* Support git remotes that use an url with a user name that is URL encoded. * Fix git-lfs special remote ssh endpoint discovery when the repository path is URL encoded. In the previous commit, Git.Url.host was made to do URL decoding. That made me wonder, what about URL encoded username and path? And so to these two additional fixes. Note that Git.Url.authority remains URL encoded. That seems ok given how it's used.
This commit is contained in:
parent
ff520b06ac
commit
bb04d1e71f
2 changed files with 10 additions and 4 deletions
|
@ -12,6 +12,9 @@ git-annex (10.20250321) UNRELEASED; urgency=medium
|
||||||
* migrate: Fix --remove-size to work when a file is not present.
|
* migrate: Fix --remove-size to work when a file is not present.
|
||||||
Fixes reversion introduced in version 10.20231129.
|
Fixes reversion introduced in version 10.20231129.
|
||||||
* Support git remotes that use a IPV6 link-local address with a zone ID.
|
* Support git remotes that use a IPV6 link-local address with a zone ID.
|
||||||
|
* Support git remotes that use an url with a user name that is URL encoded.
|
||||||
|
* Fix git-lfs special remote ssh endpoint discovery when the repository
|
||||||
|
path is URL encoded.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 21 Mar 2025 12:27:11 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 21 Mar 2025 12:27:11 -0400
|
||||||
|
|
||||||
|
|
11
Git/Url.hs
11
Git/Url.hs
|
@ -54,10 +54,13 @@ port r =
|
||||||
Just (':':p) -> readish p
|
Just (':':p) -> readish p
|
||||||
Just _ -> Nothing
|
Just _ -> Nothing
|
||||||
|
|
||||||
{- Hostname of an URL repo, including any username (ie, "user@host") -}
|
{- Hostname of an URL repo, including any username (ie, "user@host")
|
||||||
|
-
|
||||||
|
- Both the username and hostname are URI-decoded.
|
||||||
|
-}
|
||||||
hostuser :: Repo -> Maybe String
|
hostuser :: Repo -> Maybe String
|
||||||
hostuser r = (++)
|
hostuser r = (++)
|
||||||
<$> authpart uriUserInfo r
|
<$> authpart (unEscapeString . uriUserInfo) r
|
||||||
<*> host r
|
<*> host r
|
||||||
|
|
||||||
{- The full authority portion an URL repo. (ie, "user@host:port") -}
|
{- The full authority portion an URL repo. (ie, "user@host:port") -}
|
||||||
|
@ -71,7 +74,7 @@ authpart :: (URIAuth -> a) -> Repo -> Maybe a
|
||||||
authpart a Repo { location = Url u } = a <$> uriAuthority u
|
authpart a Repo { location = Url u } = a <$> uriAuthority u
|
||||||
authpart _ _ = Nothing
|
authpart _ _ = Nothing
|
||||||
|
|
||||||
{- Path part of an URL repo. -}
|
{- Path part of an URL repo. It is URI-decoded. -}
|
||||||
path :: Repo -> Maybe FilePath
|
path :: Repo -> Maybe FilePath
|
||||||
path Repo { location = Url u } = Just (uriPath u)
|
path Repo { location = Url u } = Just $ unEscapeString $ uriPath u
|
||||||
path _ = Nothing
|
path _ = Nothing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue