From 1292c38a52e103ff49642968adf2e6c8d01f35ad Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 2 Oct 2015 12:38:02 -0400 Subject: disabling verification also disables size verification It's not expensive to do size verification, but let's be consistent and turn it off too. --- Annex/Content.hs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Annex/Content.hs') diff --git a/Annex/Content.hs b/Annex/Content.hs index 34d4957bf..266cb9ac1 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -245,28 +245,28 @@ getViaTmp' v key action = do ) {- Verifies that a file is the expected content of a key. + - Configuration can prevent verification, for either a + - particular remote or always. - - Most keys have a known size, and if so, the file size is checked. - - This is not expensive, so is always done. - - When the key's backend allows verifying the content (eg via checksum), - - it is checked. This is an expensive check, so configuration can prevent - - it, for either a particular remote or always. + - it is checked. -} verifyKeyContent :: Verify -> Key -> FilePath -> Annex Bool -verifyKeyContent v k f = verifysize <&&> verifycontent +verifyKeyContent v k f = ifM (shouldVerify v) + ( verifysize <&&> verifycontent + , return True + ) where verifysize = case Types.Key.keySize k of Nothing -> return True Just size -> do size' <- liftIO $ catchDefaultIO 0 $ getFileSize f return (size' == size) - verifycontent = ifM (shouldVerify v) - ( case Types.Backend.verifyKeyContent =<< Backend.maybeLookupBackendName (Types.Key.keyBackendName k) of - Nothing -> return True - Just verifier -> verifier k f - , return True - ) + verifycontent = case Types.Backend.verifyKeyContent =<< Backend.maybeLookupBackendName (Types.Key.keyBackendName k) of + Nothing -> return True + Just verifier -> verifier k f data Verify = AlwaysVerify | NoVerify | RemoteVerify Remote | DefaultVerify -- cgit v1.2.3