aboutsummaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-10-11 11:09:27 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-10-11 11:10:33 -0400
commitba878c4ddc20e58736989584312cb58073160aed (patch)
treed94a857f3cf940271a8037ebd4173eac6f3898e8 /Remote
parent148aebe3ff9e4953a4800aa0301c8c6038587ed0 (diff)
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.
Diffstat (limited to 'Remote')
-rw-r--r--Remote/WebDAV/DavLocation.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Remote/WebDAV/DavLocation.hs b/Remote/WebDAV/DavLocation.hs
index cbe87e6a7..42c9d35d4 100644
--- a/Remote/WebDAV/DavLocation.hs
+++ b/Remote/WebDAV/DavLocation.hs
@@ -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