diff options
author | Joey Hess <joey@kitenet.net> | 2012-02-18 12:08:02 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-02-18 12:08:02 -0400 |
commit | 779ec919086a47ca0293a72f1fb452220651d0c5 (patch) | |
tree | 2505df3a7acda5768bc55286807d3fcd46c8a070 /Command/AddUrl.hs | |
parent | abd50e01fbf08ddf4a71c243febe6474dfb566df (diff) |
more robustness fixes
Diffstat (limited to 'Command/AddUrl.hs')
-rw-r--r-- | Command/AddUrl.hs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index b27cb7f0f..6c945baf9 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -44,20 +44,24 @@ start optfile pathdepth s = notBareRepo $ go $ fromMaybe bad $ parseURI s go url = do let file = fromMaybe (url2file url pathdepth) optfile showStart "addurl" file - next $ perform s file pathdepth + next $ perform s file -perform :: String -> FilePath -> Maybe Int -> CommandPerform -perform url file pathdepth = ifAnnexed file addurl geturl +perform :: String -> FilePath -> CommandPerform +perform url file = ifAnnexed file addurl geturl where geturl = do liftIO $ createDirectoryIfMissing True (parentDir file) fast <- Annex.getState Annex.fast if fast then nodownload url file else download url file addurl (key, _backend) = do - unlessM (liftIO $ Url.check url (keySize key)) $ - error $ "failed to verify url: " ++ url - setUrlPresent key url - next $ return True + ok <- liftIO $ Url.check url (keySize key) + if ok + then do + setUrlPresent key url + next $ return True + else do + warning $ "failed to verify url: " ++ url + stop download :: String -> FilePath -> CommandPerform download url file = do |