summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Remote/WebDAV.hs17
-rw-r--r--doc/todo/export.mdwn12
2 files changed, 16 insertions, 13 deletions
diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs
index 5e853ae22..8c72365e6 100644
--- a/Remote/WebDAV.hs
+++ b/Remote/WebDAV.hs
@@ -201,9 +201,15 @@ checkPresentExportDav r mh _k loc = case mh of
either giveup return v
renameExportDav :: Maybe DavHandle -> Key -> ExportLocation -> ExportLocation -> Annex Bool
-renameExportDav mh _k src dest = runExport mh $ \dav -> do
- moveDAV (baseURL dav) (exportLocation src) (exportLocation dest)
- return True
+renameExportDav Nothing _ _ _ = return False
+renameExportDav (Just h) _k src dest
+ -- box.com's DAV endpoint has buggy handling of renames,
+ -- so avoid renaming when using it.
+ | boxComUrl `isPrefixOf` baseURL h = return False
+ | otherwise = runExport (Just h) $ \dav -> do
+ maybe noop (void . mkColRecursive) (locationParent (exportLocation dest))
+ moveDAV (baseURL dav) (exportLocation src) (exportLocation dest)
+ return True
runExport :: Maybe DavHandle -> (DavHandle -> DAVT IO Bool) -> Annex Bool
runExport Nothing _ = return False
@@ -213,7 +219,10 @@ configUrl :: Remote -> Maybe URLString
configUrl r = fixup <$> M.lookup "url" (config r)
where
-- box.com DAV url changed
- fixup = replace "https://www.box.com/dav/" "https://dav.box.com/dav/"
+ fixup = replace "https://www.box.com/dav/" boxComUrl
+
+boxComUrl :: URLString
+boxComUrl = "https://dav.box.com/dav/"
type DavUser = B8.ByteString
type DavPass = B8.ByteString
diff --git a/doc/todo/export.mdwn b/doc/todo/export.mdwn
index 45fc56995..efa8b1c38 100644
--- a/doc/todo/export.mdwn
+++ b/doc/todo/export.mdwn
@@ -40,12 +40,6 @@ Low priority:
Run each pair in turn. Then run the current rename code. Although this
still probably misses cases, where eg, content cycles amoung 3 files, and
the same content amoung 3 other files. Is there a general algorythm?
-* Exporting to box.com via webdav, a rename of a file behaves
- oddly. The rename to the temp file succeeds, but the rename of the temp
- file to the final name fails.
- Also, sometimes the delete of the temp file that's done as a fallback
- fails to actually delete it.
- Hypothesis: Those are done in separate http connections and it might be
- talking to two different backend servers that are out of sync.
- So, making export cache connections might help. Update: No, caching
- connections did not solve it.
+* webdav: When a file in a subdirectory gets deleted,
+ the webdav collection is remains, empty. Need to check if collection is
+ empty, and delete otherwise.