aboutsummaryrefslogtreecommitdiff
path: root/Command/AddUrl.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-02-10 19:40:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-02-10 19:40:54 -0400
commita3ebf16e62e4499401165eebc8cf3d7123dc4fe7 (patch)
treeb8e9563b07a48c4b80bda13a9ae4d6b097a590ba /Command/AddUrl.hs
parent17fed709c83de69c5bdf190b80eaa875fe6c9c7e (diff)
also verify new urls when adding them to existing files
Diffstat (limited to 'Command/AddUrl.hs')
-rw-r--r--Command/AddUrl.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index 40e3a0e98..db73f14e9 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -19,6 +19,7 @@ import qualified Utility.Url as Url
import Annex.Content
import Logs.Web
import qualified Option
+import Types.Key
def :: [Command]
def = [withOptions [fileOption] $
@@ -50,6 +51,8 @@ perform url file = ifAnnexed file addurl geturl
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