Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
  • Loading branch information
artonge authored and backportbot[bot] committed Nov 25, 2025
commit 8afe1dd53a3e8e6a29e253117b13528e534ca597
1 change: 1 addition & 0 deletions lib/private/Files/Storage/Wrapper/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ protected function fixUnencryptedSize(string $path, int $size, int $unencryptedS
if (strlen($lastChunkContentEncrypted) > $blockSize) {
$newUnencryptedSize += $unencryptedBlockSize;
$lastChunkContentEncrypted = substr($lastChunkContentEncrypted, $blockSize);
$lastChunkNr++;
}
}

Expand Down
Loading