summaryrefslogtreecommitdiff
path: root/Command/AddUrl.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-10-11 14:21:06 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-10-11 14:21:06 -0400
commit388d27825323091f317ed380e3105f88df3f66cb (patch)
tree24e27eef33ae4949affe6d42079dd07d7a925cc2 /Command/AddUrl.hs
parent6af9822118dca6c9416c0d13635b13ee68bd13f6 (diff)
parentf81b89510d558ee38e6338c433e4f1b01c2cd5f3 (diff)
Merge branch 'master' into incrementalfsck
Diffstat (limited to 'Command/AddUrl.hs')
-rw-r--r--Command/AddUrl.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index b90297f27..27ca72d1a 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -124,14 +124,16 @@ perform relaxed url file = ifAnnexed file addurl geturl
next $ return True
| otherwise = do
headers <- getHttpHeaders
- ifM (Url.withUserAgent $ Url.check url headers $ keySize key)
- ( do
+ (exists, samesize) <- Url.withUserAgent $ Url.check url headers $ keySize key
+ if exists && samesize
+ then do
setUrlPresent key url
next $ return True
- , do
- warning $ "failed to verify url exists: " ++ url
+ else do
+ warning $ if exists
+ then "url does not have expected file size (use --relaxed to bypass this check) " ++ url
+ else "failed to verify url exists: " ++ url
stop
- )
addUrlFile :: Bool -> URLString -> FilePath -> Annex Bool
addUrlFile relaxed url file = do