summaryrefslogtreecommitdiff
path: root/Remote/WebDAV.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-09 18:42:29 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-09 18:42:29 -0400
commit0c893f8743bab81077e3ee0fed0993b746d7a269 (patch)
treeb3ddc0665c28fadbfac58fbc43fc8a9dc85f3956 /Remote/WebDAV.hs
parent680e6839ee42c754a58f8e57bf15a8063a16c6bb (diff)
Special remotes now all rollback storage of keys that get modified during the transfer, which can happen in direct mode.
Diffstat (limited to 'Remote/WebDAV.hs')
-rw-r--r--Remote/WebDAV.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs
index 21a1456bf..fe45d7df0 100644
--- a/Remote/WebDAV.hs
+++ b/Remote/WebDAV.hs
@@ -83,15 +83,17 @@ webdavSetup u c = do
store :: Remote -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
store r k _f p = metered (Just p) k $ \meterupdate ->
- davAction r False $ \(baseurl, user, pass) -> sendAnnex k $ \src ->
- liftIO $ withMeteredFile src meterupdate $
- storeHelper r k baseurl user pass
+ davAction r False $ \(baseurl, user, pass) ->
+ sendAnnex k (void $ remove r k) $ \src ->
+ liftIO $ withMeteredFile src meterupdate $
+ storeHelper r k baseurl user pass
storeEncrypted :: Remote -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
storeEncrypted r (cipher, enck) k p = metered (Just p) k $ \meterupdate ->
- davAction r False $ \(baseurl, user, pass) -> sendAnnex k $ \src ->
- liftIO $ encrypt cipher (streamMeteredFile src meterupdate) $
- readBytes $ storeHelper r enck baseurl user pass
+ davAction r False $ \(baseurl, user, pass) ->
+ sendAnnex k (void $ remove r enck) $ \src ->
+ liftIO $ encrypt cipher (streamMeteredFile src meterupdate) $
+ readBytes $ storeHelper r enck baseurl user pass
storeHelper :: Remote -> Key -> DavUrl -> DavUser -> DavPass -> L.ByteString -> IO Bool
storeHelper r k baseurl user pass b = catchBoolIO $ do