diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-26 22:52:47 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-26 22:52:47 -0400 |
commit | 51a6a833c5e07d8ac57ab8857c649669502d9f6b (patch) | |
tree | 1bddfdb0b518cca028d601c2032ccace5a3c7416 /Remote/Directory.hs | |
parent | 0859c35391c71bcacd99c1c383885a40b849e1a0 (diff) |
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.
Diffstat (limited to 'Remote/Directory.hs')
-rw-r--r-- | Remote/Directory.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs index ae2c43200..c30c3c263 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -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 |