From 4315fd674b0e9163f0026d8d164f03be53124b9f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 5 May 2015 14:05:02 -0400 Subject: Support checking ftp urls for file presence. --- Utility/Url.hs | 10 +++++++--- debian/changelog | 1 + ...ex_get__34___after___34__git_annex_addurl_--file__34__.mdwn | 5 +++++ 3 files changed, 13 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 diff --git a/debian/changelog b/debian/changelog index d7efa4228..39bfe5748 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Tue, 21 Apr 2015 15:54:10 -0400 diff --git a/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn b/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn index d9ab7670d..1081b7acf 100644 --- a/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn +++ b/doc/bugs/git-annex_deletes_file_when_using___34__git_annex_get__34___after___34__git_annex_addurl_--file__34__.mdwn @@ -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]] -- cgit v1.2.3