httpalso: Windows url fix

This commit is contained in:
Joey Hess 2025-03-26 11:42:58 -04:00
parent 7e74932f7c
commit d06bb4b540
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 29 additions and 2 deletions

View file

@ -6,6 +6,7 @@ git-annex (10.20250321) UNRELEASED; urgency=medium
* Fix build without the assistant. * Fix build without the assistant.
* fsck: Avoid complaining about required content of dead repositories. * fsck: Avoid complaining about required content of dead repositories.
* drop: Avoid redundant object directory thawing. * drop: Avoid redundant object directory thawing.
* httpalso: Windows url fix.
-- 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

View file

@ -1,6 +1,6 @@
{- HttpAlso remote (readonly). {- HttpAlso remote (readonly).
- -
- Copyright 2020-2023 Joey Hess <id@joeyh.name> - Copyright 2020-2025 Joey Hess <id@joeyh.name>
- -
- Licensed under the GNU AGPL version 3 or higher. - Licensed under the GNU AGPL version 3 or higher.
-} -}
@ -24,6 +24,7 @@ import Utility.Metered
import Annex.Verify import Annex.Verify
import qualified Annex.Url as Url import qualified Annex.Url as Url
import Annex.SpecialRemote.Config import Annex.SpecialRemote.Config
import Git.FilePath
import Data.Either import Data.Either
import qualified Data.Map as M import qualified Data.Map as M
@ -228,5 +229,10 @@ supportedLayouts baseurl =
] ]
] ]
where where
mkurl k hasher = baseurl P.</> fromOsPath (hasher k) P.</> kf k mkurl k hasher = baseurl
-- On windows, the hasher uses `\` path separators,
-- but for an url, it needs to use '/'.
-- So, use toInternalGitPath.
P.</> fromOsPath (toInternalGitPath (hasher k))
P.</> kf k
kf k = fromOsPath (keyFile k) kf k = fromOsPath (keyFile k)

View file

@ -37,3 +37,5 @@ The dataset https://github.com/courtois-neuromod/algonauts_2025.competitors can
Yes, our whole data management relies on git-annex and datalad! Thanks for that amazing tool! Yes, our whole data management relies on git-annex and datalad! Thanks for that amazing tool!
[[!tag projects/datalad]] [[!tag projects/datalad]]
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,18 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2025-03-26T15:36:35Z"
content="""
> `xw%5CXV%5C` should be something like `xw/XV` so some conversion of
> the windows backslash to posix might not be working
That was a good analysis, thanks!
I see that Remote.HttpAlso.supportedLayouts uses hashDirLower and
hashDirMixed. Which are implemented using OS-native path separators.
So, on Windows, that does come out with the slash the wrong way around.
I don't think that the actual url-encoding of it is problimatic.
I've put in a workaround. I have not tested on windows, so please re-open
this bug report if you upgrade and find it still somehow doesn't work.
"""]]