fix key checking when a directory special remote's directory is missing

The best thing to do in this case is return Left, so that anything that
tries to access it will fail.
This commit is contained in:
Joey Hess 2014-07-26 22:52:47 -04:00
parent 93be3296fc
commit 0d89b65bfc

View file

@ -168,5 +168,11 @@ remove d k = liftIO $ do
checkPresent :: FilePath -> ChunkConfig -> Key -> Annex (Either String Bool)
checkPresent d (LegacyChunks _) k = Legacy.checkPresent d locations k
checkPresent d _ k = liftIO $ catchMsgIO $
anyM doesFileExist (locations d k)
checkPresent d _ k = liftIO $ do
v <- catchMsgIO $ anyM doesFileExist (locations d k)
case v of
Right False -> ifM (doesDirectoryExist d)
( return v
, return $ Left $ "directory " ++ d ++ " is not accessible"
)
_ -> return v