summaryrefslogtreecommitdiff
path: root/Command/RecvKey.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-06 17:30:57 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-06 17:30:57 -0400
commitb5e25fc0b619f21fb8ebe202a07db5eacd5d4df7 (patch)
tree8af64ca0c858ffb984dc4e9e4b866ef1e9a98449 /Command/RecvKey.hs
parent8ece8d39e8fff3ecef1815a7c0d7a37aa4bcb46f (diff)
git-annex-shell: Ensure that received files can be read. Files transferred from some Android devices may have very broken permissions as received.
Diffstat (limited to 'Command/RecvKey.hs')
-rw-r--r--Command/RecvKey.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs
index 041e104a7..840fd34cb 100644
--- a/Command/RecvKey.hs
+++ b/Command/RecvKey.hs
@@ -44,13 +44,19 @@ start key = ifM (inAnnex key)
go tmp = do
opts <- filterRsyncSafeOptions . maybe [] words
<$> getField "RsyncOptions"
- ifM (liftIO $ rsyncServerReceive (map Param opts) tmp)
- ( ifM (isJust <$> Fields.getField Fields.direct)
+ ok <- liftIO $ rsyncServerReceive (map Param opts) tmp
+
+ -- The file could have been received with permissions that
+ -- do not allow reading it, so this is done before the
+ -- directcheck.
+ freezeContent tmp
+
+ if ok
+ then ifM (isJust <$> Fields.getField Fields.direct)
( directcheck tmp
, return True
)
- , return False
- )
+ else return False
{- If the sending repository uses direct mode, the file
- it sends could be modified as it's sending it. So check
- that the right size file was received, and that the key/value