webdav: Changed path used on webdav server for temporary files.
Done to avoid a "tmp" directory appearing in webdav exports. Also affects non-export webdav remotes, so interrupted uploads using the old path will not overwrite it. However, PUT is quite likely to be implemented atomically on web servers anyway, so I doubt this will cause problems.
This commit is contained in:
parent
1223960294
commit
cf51f40f0e
3 changed files with 8 additions and 10 deletions
|
@ -16,6 +16,7 @@ git-annex (6.20170819) UNRELEASED; urgency=medium
|
||||||
the file is not present.
|
the file is not present.
|
||||||
* webdav: Fix lack of url-escaping of filenames. Mostly impacted exports
|
* webdav: Fix lack of url-escaping of filenames. Mostly impacted exports
|
||||||
of filenames containing eg spaces.
|
of filenames containing eg spaces.
|
||||||
|
* webdav: Changed path used on webdav server for temporary files.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 28 Aug 2017 12:20:59 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 28 Aug 2017 12:20:59 -0400
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ store _ (Just dav) = httpStorer $ \k reqbody -> liftIO $ goDAV dav $ do
|
||||||
|
|
||||||
storeHelper :: DavHandle -> DavLocation -> DavLocation -> RequestBody -> DAVT IO ()
|
storeHelper :: DavHandle -> DavLocation -> DavLocation -> RequestBody -> DAVT IO ()
|
||||||
storeHelper dav tmp dest reqbody = do
|
storeHelper dav tmp dest reqbody = do
|
||||||
void $ mkColRecursive tmpDir
|
maybe noop (void . mkColRecursive) (locationParent tmp)
|
||||||
inLocation tmp $
|
inLocation tmp $
|
||||||
putContentM' (contentType, reqbody)
|
putContentM' (contentType, reqbody)
|
||||||
finalizeStore dav tmp dest
|
finalizeStore dav tmp dest
|
||||||
|
@ -257,8 +257,8 @@ testDav url (Just (u, p)) = do
|
||||||
test $ liftIO $ evalDAVT url $ do
|
test $ liftIO $ evalDAVT url $ do
|
||||||
prepDAV user pass
|
prepDAV user pass
|
||||||
makeParentDirs
|
makeParentDirs
|
||||||
void $ mkColRecursive tmpDir
|
void $ mkColRecursive "/"
|
||||||
inLocation (tmpLocation "git-annex-test") $ do
|
inLocation (tmpLocation "test") $ do
|
||||||
putContentM (Nothing, L8.fromString "test")
|
putContentM (Nothing, L8.fromString "test")
|
||||||
delContentM
|
delContentM
|
||||||
where
|
where
|
||||||
|
|
|
@ -46,18 +46,15 @@ keyDir k = addTrailingPathSeparator $ hashdir </> keyFile k
|
||||||
keyLocation :: Key -> DavLocation
|
keyLocation :: Key -> DavLocation
|
||||||
keyLocation k = keyDir k ++ keyFile k
|
keyLocation k = keyDir k ++ keyFile k
|
||||||
|
|
||||||
|
exportLocation :: ExportLocation -> DavLocation
|
||||||
|
exportLocation (ExportLocation f) = f
|
||||||
|
|
||||||
{- Where we store temporary data for a key as it's being uploaded. -}
|
{- Where we store temporary data for a key as it's being uploaded. -}
|
||||||
keyTmpLocation :: Key -> DavLocation
|
keyTmpLocation :: Key -> DavLocation
|
||||||
keyTmpLocation = tmpLocation . keyFile
|
keyTmpLocation = tmpLocation . keyFile
|
||||||
|
|
||||||
exportLocation :: ExportLocation -> DavLocation
|
|
||||||
exportLocation (ExportLocation f) = f
|
|
||||||
|
|
||||||
tmpLocation :: FilePath -> DavLocation
|
tmpLocation :: FilePath -> DavLocation
|
||||||
tmpLocation f = tmpDir </> f
|
tmpLocation f = "git-annex-webdav-tmp-" ++ f
|
||||||
|
|
||||||
tmpDir :: DavLocation
|
|
||||||
tmpDir = "tmp"
|
|
||||||
|
|
||||||
locationParent :: String -> Maybe String
|
locationParent :: String -> Maybe String
|
||||||
locationParent loc
|
locationParent loc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue