summaryrefslogtreecommitdiff
path: root/Backend
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-02-25 01:13:01 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-02-25 01:13:01 -0400
commit836e71297b8e3b5bd6f89f7eb1198f59af985b0b (patch)
tree835db9db776b23552736422baf9794eb6a3ac5e5 /Backend
parente61b47bc8a51447f9fbde6463e09d4beef8d5a7f (diff)
Support filenames that start with a dash; when such a file is passed to a utility it will be escaped to avoid it being interpreted as an option.
Diffstat (limited to 'Backend')
-rw-r--r--Backend/SHA1.hs3
-rw-r--r--Backend/URL.hs2
2 files changed, 3 insertions, 2 deletions
diff --git a/Backend/SHA1.hs b/Backend/SHA1.hs
index 9636787f0..e1830bc13 100644
--- a/Backend/SHA1.hs
+++ b/Backend/SHA1.hs
@@ -20,6 +20,7 @@ import qualified Annex
import Locations
import Content
import Types
+import Utility
backend :: Backend Annex
backend = Backend.File.backend {
@@ -31,7 +32,7 @@ backend = Backend.File.backend {
sha1 :: FilePath -> Annex String
sha1 file = do
showNote "checksum..."
- liftIO $ pOpen ReadFromPipe "sha1sum" [file] $ \h -> do
+ liftIO $ pOpen ReadFromPipe "sha1sum" [utilityEscape file] $ \h -> do
line <- hGetLine h
let bits = split " " line
if null bits
diff --git a/Backend/URL.hs b/Backend/URL.hs
index 38954e5a3..15cc88d64 100644
--- a/Backend/URL.hs
+++ b/Backend/URL.hs
@@ -51,6 +51,6 @@ downloadUrl :: Key -> FilePath -> Annex Bool
downloadUrl key file = do
showNote "downloading"
showProgress -- make way for curl progress bar
- liftIO $ boolSystem "curl" ["-#", "-o", file, url]
+ liftIO $ boolSystem "curl" ["-#", "-o", utilityEscape file, url]
where
url = join ":" $ drop 1 $ split ":" $ show key