diff --git a/CHANGELOG b/CHANGELOG index 378b5c5798..5934afe3e0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,8 @@ git-annex (6.20170819) UNRELEASED; urgency=medium triggered a bug in its webdav support that generates an infinite series of redirects. Deal with such problems by assuming such behavior means the file is not present. + * webdav: Fix lack of url-escaping of filenames. Mostly impacted exports + of filenames containing eg spaces. -- Joey Hess Mon, 28 Aug 2017 12:20:59 -0400 diff --git a/Remote/WebDAV/DavLocation.hs b/Remote/WebDAV/DavLocation.hs index 82a3739d00..81777e887a 100644 --- a/Remote/WebDAV/DavLocation.hs +++ b/Remote/WebDAV/DavLocation.hs @@ -21,14 +21,17 @@ import Utility.Split import System.FilePath.Posix -- for manipulating url paths import Network.Protocol.HTTP.DAV (inDAVLocation, DAVT) import Control.Monad.IO.Class (MonadIO) +import Network.URI import Data.Default -- Relative to the top of the DAV url. type DavLocation = String -{- Runs action in subdirectory, relative to the current location. -} +{- Runs action with a new location relative to the current location. -} inLocation :: (MonadIO m) => DavLocation -> DAVT m a -> DAVT m a -inLocation d = inDAVLocation ( d) +inLocation d = inDAVLocation ( d') + where + d' = escapeURIString isUnescapedInURI d {- The directory where files(s) for a key are stored. -} keyDir :: Key -> DavLocation