fix(encryption): Increment lastChunkNr when size is off

When computing the unencrypted file size, we need the size of the last encrypted chunk as its size is usually not the regular 8192 bits.

To avoid reading the whole file, we seek directly to that last chunk based on the expected file size. When the expected file size is smaller than the actual one, we have a logic in place to continue reading until we reach the end of the file.

In that logic, we forgot to increment the `$lastChunkNr` which is important when we later check the signature of the chunk.

This commit adds that missing increment.

Signed-off-by: Louis Chmn <louis@chmn.me>
pull/55981/head
Louis Chmn 2025-10-24 13:44:24 +07:00 committed by Louis
parent ff5041fc8e
commit 30d567fd0e
1 changed files with 1 additions and 0 deletions

@ -464,6 +464,7 @@ class Encryption extends Wrapper {
if (strlen($lastChunkContentEncrypted) > $blockSize) {
$newUnencryptedSize += $unencryptedBlockSize;
$lastChunkContentEncrypted = substr($lastChunkContentEncrypted, $blockSize);
$lastChunkNr++;
}
}