diff options
author | Joey Hess <joey@kitenet.net> | 2014-08-08 14:57:05 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-08-08 14:57:05 -0400 |
commit | 5a7ed9c53b5fe0f54043f130bd968a28d789b38b (patch) | |
tree | 3df26f7c53b592a3dad3596f4398864d4af271ec /Remote | |
parent | 49f5a1be8bc8b6aee6d65d61d316571317b79174 (diff) |
fix removeKey when not present
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/WebDAV.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs index af3af7902..d344e0a74 100644 --- a/Remote/WebDAV.hs +++ b/Remote/WebDAV.hs @@ -128,9 +128,16 @@ remove Nothing _ = return False remove (Just dav) k = liftIO $ do -- Delete the key's whole directory, including any -- legacy chunked files, etc, in a single action. - ret <- goDAV dav $ safely $ - inLocation (keyDir k) delContentM - return (isJust ret) + let d = keyDir k + goDAV dav $ do + v <- safely $ inLocation d delContentM + case v of + Just _ -> return True + Nothing -> do + v' <- existsDAV d + case v' of + Right False -> return True + _ -> return False checkKey :: Remote -> ChunkConfig -> Maybe DavHandle -> CheckPresent checkKey r _ Nothing _ = error $ name r ++ " not configured" |