httpalso: Windows url fix
authorJoey Hess <joeyh@joeyh.name>
Wed, 26 Mar 2025 15:42:58 +0000 (11:42 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 26 Mar 2025 15:42:58 +0000 (11:42 -0400)
CHANGELOG
Remote/HttpAlso.hs
doc/bugs/httpalso_windows_URL_errors.mdwn
doc/bugs/httpalso_windows_URL_errors/comment_1_f44b285c7d3b04db73747369793d2ca2._comment [new file with mode: 0644]

index 3202d1afe57e01ec8fae0f451e45f84c7adb288b..b2ac6a0a44214c3263104f0c87a24315e2087369 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@ git-annex (10.20250321) UNRELEASED; urgency=medium
   * Fix build without the assistant.
   * fsck: Avoid complaining about required content of dead repositories.
   * drop: Avoid redundant object directory thawing.
+  * httpalso: Windows url fix.
 
  -- Joey Hess <id@joeyh.name>  Fri, 21 Mar 2025 12:27:11 -0400
 
index de0d9e4c0969571dd1ccdc19c41196dcaa74350e..d6ccf15c134977b54da56a92947894ccda4d9693 100644 (file)
@@ -1,6 +1,6 @@
 {- 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.
  -}
@@ -24,6 +24,7 @@ import Utility.Metered
 import Annex.Verify
 import qualified Annex.Url as Url
 import Annex.SpecialRemote.Config
+import Git.FilePath
 
 import Data.Either
 import qualified Data.Map as M
@@ -228,5 +229,10 @@ supportedLayouts baseurl =
          ]
        ]
   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)
index 90b84f1ed06a0987ac911ff9d6d4bc28cb3159b9..f84750067210446a1a1cee3efa6bbce262ea80f3 100644 (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! 
 
 [[!tag projects/datalad]]
+
+> [[fixed|done]] --[[Joey]]
diff --git a/doc/bugs/httpalso_windows_URL_errors/comment_1_f44b285c7d3b04db73747369793d2ca2._comment b/doc/bugs/httpalso_windows_URL_errors/comment_1_f44b285c7d3b04db73747369793d2ca2._comment
new file mode 100644 (file)
index 0000000..335daf7
--- /dev/null
@@ -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.
+"""]]