disabling verification also disables size verification
It's not expensive to do size verification, but let's be consistent and turn it off too.
This commit is contained in:
parent
c6632ee5c8
commit
7c7fe895f9
1 changed files with 10 additions and 10 deletions
|
@ -245,28 +245,28 @@ getViaTmp' v key action = do
|
||||||
)
|
)
|
||||||
|
|
||||||
{- Verifies that a file is the expected content of a key.
|
{- 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.
|
- 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),
|
- 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 is checked.
|
||||||
- it, for either a particular remote or always.
|
|
||||||
-}
|
-}
|
||||||
verifyKeyContent :: Verify -> Key -> FilePath -> Annex Bool
|
verifyKeyContent :: Verify -> Key -> FilePath -> Annex Bool
|
||||||
verifyKeyContent v k f = verifysize <&&> verifycontent
|
verifyKeyContent v k f = ifM (shouldVerify v)
|
||||||
|
( verifysize <&&> verifycontent
|
||||||
|
, return True
|
||||||
|
)
|
||||||
where
|
where
|
||||||
verifysize = case Types.Key.keySize k of
|
verifysize = case Types.Key.keySize k of
|
||||||
Nothing -> return True
|
Nothing -> return True
|
||||||
Just size -> do
|
Just size -> do
|
||||||
size' <- liftIO $ catchDefaultIO 0 $ getFileSize f
|
size' <- liftIO $ catchDefaultIO 0 $ getFileSize f
|
||||||
return (size' == size)
|
return (size' == size)
|
||||||
verifycontent = ifM (shouldVerify v)
|
verifycontent = case Types.Backend.verifyKeyContent =<< Backend.maybeLookupBackendName (Types.Key.keyBackendName k) of
|
||||||
( case Types.Backend.verifyKeyContent =<< Backend.maybeLookupBackendName (Types.Key.keyBackendName k) of
|
|
||||||
Nothing -> return True
|
Nothing -> return True
|
||||||
Just verifier -> verifier k f
|
Just verifier -> verifier k f
|
||||||
, return True
|
|
||||||
)
|
|
||||||
|
|
||||||
data Verify = AlwaysVerify | NoVerify | RemoteVerify Remote | DefaultVerify
|
data Verify = AlwaysVerify | NoVerify | RemoteVerify Remote | DefaultVerify
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue