Init encryption module before calculating unencrypted block-size #40240
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes a bug where the un-encrypted blocksize was calculated before initializing the encryption-module. This yields the wrong size after a file-scan. The issue is only triggered if encryption.use_legacy_encoding is set to true.
Related Issue
Related test PR: owncloud/encryption#360 (comment)
Motivation and Context
When restoring encrypted files from backup and doing a
occ file:scan --repair
andencryption:fix-encrypted-version
the file was still not readable correctly because the size in oc_filecache is wrong.The wrong calculation was introduced via #38249 where the size calculation depends on the encoding mode (binary vs base64). The code assumes that the begin method is called before the size is calculated which is not the case for the call-site which this PR fixes.
How Has This Been Tested?
Types of changes
Checklist: