webdav: Avoid trying to set props, avoiding incompatability with livedrive.com. Needs DAV version 0.3.

This commit is contained in:
Joey Hess 2012-12-01 17:12:41 -04:00
parent b4e2a8358e
commit 5460414486
4 changed files with 8 additions and 13 deletions

View file

@ -14,8 +14,6 @@ import qualified Data.Map as M
import qualified Data.ByteString.UTF8 as B8
import qualified Data.ByteString.Lazy.UTF8 as L8
import qualified Data.ByteString.Lazy as L
import qualified Data.Text.Lazy as LT
import qualified Text.XML as XML
import Network.URI (normalizePathSegments)
import qualified Control.Exception as E
import Network.HTTP.Conduit (HttpException(..))
@ -109,8 +107,8 @@ storeHelper r k baseurl user pass b = catchBoolIO $ do
void $ catchMaybeHttp (deleteContent desturl user pass)
davMkdir (urlParent desturl) user pass
moveContent srcurl (B8.fromString desturl) user pass
storehttp url v = putContentAndProps url user pass
(noProps, (contentType, v))
storehttp url v = putContent url user pass
(contentType, v)
retrieveCheap :: Remote -> Key -> FilePath -> Annex Bool
retrieveCheap _ _ _ = return False
@ -293,8 +291,8 @@ testDav :: String -> Maybe CredPair -> Annex ()
testDav baseurl (Just (u, p)) = do
showSideAction "testing WebDAV server"
test "make directory" $ davMkdir baseurl user pass
test "write file" $ putContentAndProps testurl user pass
(noProps, (contentType, L.empty))
test "write file" $ putContent testurl user pass
(contentType, L.empty)
test "delete file" $ deleteContent testurl user pass
where
test desc a = liftIO $
@ -311,11 +309,6 @@ testDav _ Nothing = error "Need to configure webdav username and password."
contentType :: Maybe B8.ByteString
contentType = Just $ B8.fromString "application/octet-stream"
{- The DAV library requires that properties be specified when storing a file.
- This just omits any real properties. -}
noProps :: XML.Document
noProps = XML.parseText_ XML.def $ LT.pack "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<propertyupdate/>"
getCreds :: RemoteConfig -> UUID -> Annex (Maybe CredPair)
getCreds c u = getRemoteCredPairFor "webdav" c (davCreds u)

2
debian/changelog vendored
View file

@ -13,6 +13,8 @@ git-annex (3.20121128) UNRELEASED; urgency=low
associated with a file.
* webapp: S3 and Glacier forms now have a select list of all
currently-supported AWS regions.
* webdav: Avoid trying to set props, avoiding incompatability with
livedrive.com. Needs DAV version 0.3.
-- Joey Hess <joeyh@debian.org> Wed, 28 Nov 2012 13:31:07 -0400

2
debian/control vendored
View file

@ -13,7 +13,7 @@ Build-Depends:
libghc-http-dev,
libghc-utf8-string-dev,
libghc-hs3-dev (>= 0.5.6),
libghc-dav-dev (>= 0.2),
libghc-dav-dev (>= 0.3),
libghc-testpack-dev,
libghc-quickcheck2-dev,
libghc-monad-control-dev (>= 0.3),

View file

@ -73,7 +73,7 @@ Executable git-annex
CPP-Options: -DWITH_S3
if flag(WebDAV)
Build-Depends: DAV (>= 0.2), http-conduit, xml-conduit
Build-Depends: DAV (>= 0.3), http-conduit, xml-conduit
CPP-Options: -DWITH_WEBDAV
if flag(Assistant) && ! os(windows) && ! os(solaris)