summaryrefslogtreecommitdiff
path: root/Remote/WebDAV.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Remote/WebDAV.hs')
-rw-r--r--Remote/WebDAV.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs
index c65118efb..1a722f147 100644
--- a/Remote/WebDAV.hs
+++ b/Remote/WebDAV.hs
@@ -198,8 +198,14 @@ withStoredFiles
withStoredFiles r k baseurl user pass onerr a
| isJust $ chunkSize $ config r = do
let chunkcount = keyurl ++ chunkCount
- maybe (onerr chunkcount) (a . listChunks keyurl . L8.toString)
- =<< davGetUrlContent chunkcount user pass
+ v <- davGetUrlContent chunkcount user pass
+ case v of
+ Just s -> a $ listChunks keyurl $ L8.toString s
+ Nothing -> do
+ chunks <- probeChunks keyurl $ \u -> (== Right True) <$> davUrlExists u user pass
+ if null chunks
+ then onerr chunkcount
+ else a chunks
| otherwise = a [keyurl]
where
keyurl = davLocation baseurl k ++ keyFile k