aboutsummaryrefslogtreecommitdiff
path: root/Utility/Url.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-05-05 14:05:02 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-05-05 14:05:02 -0400
commit4315fd674b0e9163f0026d8d164f03be53124b9f (patch)
tree5af6cc2b091d8b6f8396ac8f169c0e8cca3b08c2 /Utility/Url.hs
parent37705c7157dd2190fee7da528024211b084412c0 (diff)
Support checking ftp urls for file presence.
Diffstat (limited to 'Utility/Url.hs')
-rw-r--r--Utility/Url.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Utility/Url.hs b/Utility/Url.hs
index 9c5d6a708..1d34b558f 100644
--- a/Utility/Url.hs
+++ b/Utility/Url.hs
@@ -123,10 +123,14 @@ getUrlInfo url uo = case parseURIRelaxed url of
| Build.SysConfig.curl -> do
output <- catchDefaultIO "" $
readProcess "curl" $ toCommand curlparams
+ let len = extractlencurl output
+ let good = found len Nothing
case lastMaybe (lines output) of
- Just ('2':_:_) -> found
- (extractlencurl output)
- Nothing
+ Just ('2':_:_) -> good
+ -- don't try to parse ftp status
+ -- codes; if curl got a length,
+ -- it's good
+ _ | "ftp" `isInfixOf` uriScheme u && isJust len -> good
_ -> dne
| otherwise -> dne
Nothing -> dne