summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-10 22:34:44 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-10 22:34:44 -0400
commit233e177f91a6ac504e94b32a6950bfd3d37d0c65 (patch)
tree690ef8c57d30f0f8ed5cbf140e829ee0d3fded99 /Utility
parentaecc1edcdd80c41f04e30c3e4749b3b301cd928d (diff)
avoid using curl for file:// urls since it's buggy
Diffstat (limited to 'Utility')
-rw-r--r--Utility/Url.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Utility/Url.hs b/Utility/Url.hs
index da7863091..14a6f8f6f 100644
--- a/Utility/Url.hs
+++ b/Utility/Url.hs
@@ -17,6 +17,7 @@ module Utility.Url (
import Common
import Network.URI
+import Utility.CopyFile
type URLString = String
@@ -71,11 +72,13 @@ exists url headers = case parseURI url of
- would not be appropriate to test at configure time and build support
- for only one in.
-
- - Curl is always used for file:// urls, as wget does not support them.
+ - For file:// urls, neither program works well, so we just copy.
-}
download :: URLString -> Headers -> [CommandParam] -> FilePath -> IO Bool
download url headers options file
- | "file://" `isPrefixOf` url = curl
+ | "file://" `isPrefixOf` url =
+ let f = drop (length "file://") url
+ in copyFileExternal f file
| otherwise = ifM (inPath "wget") (wget , curl)
where
headerparams = map (\h -> Param $ "--header=" ++ h) headers