Windows: Fix url to object when using a http remote.

annexLocations uses OS-native directory separators, but for an url,
it needs to use / even on Windows.

This is an ugly workaround. Could parameterize a lot of stuff in
annexLocations to fix it better. I suspect this is probably the only place
it's needed though.
This commit is contained in:
Joey Hess 2013-07-07 13:35:06 -04:00
parent 68630db661
commit 7e7b2daddf
4 changed files with 16 additions and 1 deletions

View file

@ -266,9 +266,14 @@ onLocal r a = do
a a
keyUrls :: Git.Repo -> Key -> [String] keyUrls :: Git.Repo -> Key -> [String]
keyUrls r key = map tourl (annexLocations key) keyUrls r key = map tourl locs
where where
tourl l = Git.repoLocation r ++ "/" ++ l tourl l = Git.repoLocation r ++ "/" ++ l
#ifndef __WINDOWS__
locs = annexLocations key
#else
locs = replace "\\" "/" $ annexLocations key
#endif
dropKey :: Remote -> Key -> Annex Bool dropKey :: Remote -> Key -> Annex Bool
dropKey r key dropKey r key

1
debian/changelog vendored
View file

@ -19,6 +19,7 @@ git-annex (4.20130628) UNRELEASED; urgency=low
than the urls's path. than the urls's path.
* Windows: Look for .exe extension when searching for a command in path. * Windows: Look for .exe extension when searching for a command in path.
* Pass -f to curl when downloading a file with it, so it propigates failure. * Pass -f to curl when downloading a file with it, so it propigates failure.
* Windows: Fix url to object when using a http remote.
-- Joey Hess <joeyh@debian.org> Tue, 02 Jul 2013 15:40:55 -0400 -- Joey Hess <joeyh@debian.org> Tue, 02 Jul 2013 15:40:55 -0400

View file

@ -171,3 +171,10 @@ C:\Users\test-git-annex\test_annex>type file1.txt
192.168.0.2 - - [<datetime>] "GET /test_annex/.git/annex\objects\c96\53e\SHA256-s21--6ed275e9e01c84a57fdd99d6af793c5d587d02e699cd2c28b32b7dc90f73e729\SHA256-s21--6ed275e9e01c84a57fdd99d6af793c5d587d02e699cd2c28b32b7dc90f73e729 HTTP/1.1" 404 - 192.168.0.2 - - [<datetime>] "GET /test_annex/.git/annex\objects\c96\53e\SHA256-s21--6ed275e9e01c84a57fdd99d6af793c5d587d02e699cd2c28b32b7dc90f73e729\SHA256-s21--6ed275e9e01c84a57fdd99d6af793c5d587d02e699cd2c28b32b7dc90f73e729 HTTP/1.1" 404 -
192.168.0.2 - - [<datetime>] code 404, message File not found 192.168.0.2 - - [<datetime>] code 404, message File not found
"""]] """]]
> This seems to be two distinct bugs. First, curl was not propigating the exit
> status. I already fixed that.
>
> Second, it's using DOS style path separators when constructing the url.
> `http://192.168.0.8:8000/test_annex/.git/annex\\objects\\c96`
> I've put in an (ugly) fix for that. [[done]] --[[Joey]]

View file

@ -182,3 +182,5 @@ git-annex: get: 1 failed
192.168.0.2 - - [<datetime>] code 404, message File not found 192.168.0.2 - - [<datetime>] code 404, message File not found
192.168.0.2 - - [<datetime>] "GET /test_annex/.git/annex%5Cobjects%5CJ9%5Cm6%5CSHA256-s21--6ed275e9e01c84a57fdd99d6af793c5d587d02e699cd2c28b32b7dc90f73e729%5CSHA256-s21--6ed275e9e01c84a57fdd99d6af793c5d587d02e699cd2c28b32b7dc90f73e729 HTTP/1.1" 404 - 192.168.0.2 - - [<datetime>] "GET /test_annex/.git/annex%5Cobjects%5CJ9%5Cm6%5CSHA256-s21--6ed275e9e01c84a57fdd99d6af793c5d587d02e699cd2c28b32b7dc90f73e729%5CSHA256-s21--6ed275e9e01c84a57fdd99d6af793c5d587d02e699cd2c28b32b7dc90f73e729 HTTP/1.1" 404 -
"""]] """]]
> [[fixed|done]] --[[Joey]]