summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
Diffstat (limited to 'Remote')
-rw-r--r--Remote/WebDAV.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs
index 04eb35cef..12b9d40b2 100644
--- a/Remote/WebDAV.hs
+++ b/Remote/WebDAV.hs
@@ -32,7 +32,7 @@ import Remote.Helper.Export
import qualified Remote.Helper.Chunked.Legacy as Legacy
import Creds
import Utility.Metered
-import Utility.Url (URLString, matchStatusCodeException)
+import Utility.Url (URLString, matchStatusCodeException, matchHttpExceptionContent)
import Annex.UUID
import Remote.WebDAV.DavLocation
@@ -317,11 +317,15 @@ existsDAV l = inLocation l check `catchNonAsync` (\e -> return (Left $ show e))
-- more depth is certainly not needed to check if a
-- location exists.
setDepth (Just Depth1)
- catchJust
- (matchStatusCodeException (== notFound404))
+ catchJust missinghttpstatus
(getPropsM >> ispresent True)
(const $ ispresent False)
ispresent = return . Right
+ missinghttpstatus e =
+ matchStatusCodeException (== notFound404) e
+ <|> matchHttpExceptionContent toomanyredirects e
+ toomanyredirects (TooManyRedirects _) = True
+ toomanyredirects _ = False
safely :: DAVT IO a -> DAVT IO (Maybe a)
safely = eitherToMaybe <$$> tryNonAsync