fix to use 1 chunk for empty file

Fix retrival of an empty file that is stored in a special remote with
chunking enabled.

The speculative chunk stuff caused a reversion by adding an empty list for
the empty file. Which is just wrong; the empty file is still stored on the
remote, and should be retrieved like any other file. It uses 1 chunk, so
`max 1` is the simple fix.

Sponsored-by: Noam Kremen on Patreon
This commit is contained in:
Joey Hess 2022-06-09 14:24:56 -04:00
parent f30532614f
commit 13fc6a9b6a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 23 additions and 1 deletions

View file

@ -554,7 +554,7 @@ chunkKeys' onlychunks u chunkconfig k = do
Nothing -> l
Just keysz ->
let (d, m) = keysz `divMod` fromIntegral chunksz
chunkcount = d + if m == 0 then 0 else 1
chunkcount = max 1 (d + if m == 0 then 0 else 1)
v = (FixedSizeChunks chunksz, chunkcount)
in if v `elem` recorded
then l