aboutsummaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-09-12 15:45:03 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-09-12 15:45:03 -0400
commitcdf02436fd560da7ec8e0c0d3488bb52573cb66a (patch)
tree0729af98e5344d580e25e7bb15b22cc208c8d9eb /Remote
parent8149e26f66b49af2340198cfaa794a799f80cc5f (diff)
webdav: Fix lack of url-escaping of filenames.
inDAVLocation does not url-escape, and so exporting a filename with spaces to box.com at least resulted in a error 400. It might also have affected storing keys on a webdav remote, if the key contained a space or other problem character. Pretty unlikely. I emailed Clint about the inDAVLocation gotcha, but seems best to fix it here. This commit was supported by the NSF-funded DataLad project.
Diffstat (limited to 'Remote')
-rw-r--r--Remote/WebDAV/DavLocation.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Remote/WebDAV/DavLocation.hs b/Remote/WebDAV/DavLocation.hs
index 82a3739d0..81777e887 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