summaryrefslogtreecommitdiff
path: root/Command/AddUrl.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-12 15:58:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-12 15:58:36 -0400
commit0dba6d2aeefc7755a7674d2c6e1598a238d99412 (patch)
tree3dca5b12a07d12735acfee8dd1e1b6edb115501d /Command/AddUrl.hs
parentfeb92705d8dc038d534813173fc4dba67a7559da (diff)
fix relaxed with existing file
Diffstat (limited to 'Command/AddUrl.hs')
-rw-r--r--Command/AddUrl.hs24
1 files changed, 14 insertions, 10 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index cf8aae17c..ceb35224d 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -60,16 +60,20 @@ perform relaxed url file = ifAnnexed file addurl geturl
liftIO $ createDirectoryIfMissing True (parentDir file)
ifM (Annex.getState Annex.fast <||> pure relaxed)
( nodownload relaxed url file , download url file )
- addurl (key, _backend) = do
- headers <- getHttpHeaders
- ifM (liftIO $ Url.check url headers $ keySize key)
- ( do
- setUrlPresent key url
- next $ return True
- , do
- warning $ "failed to verify url: " ++ url
- stop
- )
+ addurl (key, _backend)
+ | relaxed = do
+ setUrlPresent key url
+ next $ return True
+ | otherwise = do
+ headers <- getHttpHeaders
+ ifM (liftIO $ Url.check url headers $ keySize key)
+ ( do
+ setUrlPresent key url
+ next $ return True
+ , do
+ warning $ "failed to verify url: " ++ url
+ stop
+ )
download :: String -> FilePath -> CommandPerform
download url file = do