Support checking ftp urls for file presence.

This commit is contained in:
Joey Hess 2015-05-05 14:05:02 -04:00
parent 0b18228516
commit cf786f42a4
3 changed files with 13 additions and 3 deletions

View file

@ -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

1
debian/changelog vendored
View file

@ -29,6 +29,7 @@ git-annex (5.20150421) UNRELEASED; urgency=medium
* Android: Updated bundled ssh from 6.1p1 to 6.4p1.
* Work around wget bug #784348 which could cause it to clobber git-annex
symlinks when downloading from ftp.
* Support checking ftp urls for file presence.
-- Joey Hess <id@joeyh.name> Tue, 21 Apr 2015 15:54:10 -0400

View file

@ -105,3 +105,8 @@ $
"""]]
> workaround in place; [[done]] --[[Joey]]
> Also, fixed it to allow dropping the file if the ftp server seems
> to reply with a successful result (it's replying with 350, which is not
> unambiguously good, but since curl is able to get the right file length,
> the file is presumably still on the ftp server. --[[Joey]]