diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-30 10:34:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-30 10:34:39 -0400 |
commit | a6b6666c488f37e2e02ca0ec151283e0a41c5631 (patch) | |
tree | 672a65229a948056bb1953c80d8c6dcb7a52f530 | |
parent | ca57baac3e607e8ed878071278cc0c24746f4282 (diff) |
only chunk stable keys
The content of unstable keys can potentially be different in different
repos, so eg, resuming a chunked upload started by another repo would
corrupt data.
-rw-r--r-- | Backend.hs | 6 | ||||
-rw-r--r-- | Remote/Helper/Chunked.hs | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/Backend.hs b/Backend.hs index 99752c66f..0fcaaa7ed 100644 --- a/Backend.hs +++ b/Backend.hs @@ -15,7 +15,7 @@ module Backend ( chooseBackend, lookupBackendName, maybeLookupBackendName, - checkStableKey, + isStableKey, ) where import Common.Annex @@ -126,6 +126,6 @@ maybeLookupBackendName s = M.lookup s nameMap nameMap :: M.Map String Backend nameMap = M.fromList $ zip (map B.name list) list -checkStableKey :: Key -> Bool -checkStableKey k = maybe False (`B.isStableKey` k) +isStableKey :: Key -> Bool +isStableKey k = maybe False (`B.isStableKey` k) (maybeLookupBackendName (keyBackendName k)) diff --git a/Remote/Helper/Chunked.hs b/Remote/Helper/Chunked.hs index d9ab3c3e6..fcfe06b20 100644 --- a/Remote/Helper/Chunked.hs +++ b/Remote/Helper/Chunked.hs @@ -23,6 +23,7 @@ import Types.Key import Logs.Chunk import Utility.Metered import Crypto (EncKey) +import Backend (isStableKey) import Annex.Exception import qualified Data.ByteString.Lazy as L @@ -95,7 +96,7 @@ storeChunks -> Annex Bool storeChunks u chunkconfig k f p storer checker = case chunkconfig of - (UnpaddedChunks chunksize) -> + (UnpaddedChunks chunksize) | isStableKey k -> bracketIO open close (go chunksize) _ -> showprogress $ storer k (FileContent f) where |