webdav: Avoid unncessisarily creating the collection at the top of the repo

when storing files there, since that collection is created by initremote.
(This seems to work around some brokenness of the box.com webdav server
which was entering a redirect loop.)

Note that the fix makes locationParent return Nothing instead of "."
when there's no parent directory between the path and the top of the webdav
repo.

This commit was sponsored by André Pereira on Patreon.
This commit is contained in:
Joey Hess 2017-10-11 11:09:27 -04:00
parent 61dccecad7
commit 9aaf7e2b52
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 10 additions and 2 deletions

View file

@ -2,6 +2,11 @@ git-annex (6.20171004) UNRELEASED; urgency=medium
* webdav: Make --debug show all webdav operations.
* Fix build with aws-0.17.
* webdav: Avoid unncessisarily creating the collection at the top
of the repository when storing files there, since that collection
is created by initremote.
(This seems to work around some brokenness of the box.com webdav
server which was entering a redirect loop.)
-- Joey Hess <id@joeyh.name> Sat, 07 Oct 2017 14:11:00 -0400

View file

@ -58,10 +58,11 @@ tmpLocation f = "git-annex-webdav-tmp-" ++ f
locationParent :: String -> Maybe String
locationParent loc
| loc `elem` tops = Nothing
| otherwise = Just (takeDirectory loc)
| loc `elem` tops || parent `elem` tops = Nothing
| otherwise = Just parent
where
tops = ["/", "", "."]
parent = takeDirectory loc
locationUrl :: URLString -> DavLocation -> URLString
locationUrl baseurl loc = baseurl </> loc

View file

@ -118,3 +118,5 @@ Notice the 5 second gap here:
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Yes! Thank you!
> [[fixed|done]] --[[Joey]]