[stable33] fix(encryption): Correctly report size for zero-byte encrypted files - #62779
Merged
Conversation
Files with 0 bytes no longer incorrectly report as 8192 bytes. Widens unencryptedSize to ?int, fixes verifyUnencryptedSize to compare against header size instead of 0, and corrects Scanner to populate unencrypted_size on initial upload. Assisted-by: ClaudeCode:claude-opus-4-6 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Stephen Cuppett <steve@cuppett.com>
…stency Apply come-nc's reviewer suggestions on Scanner.php: - Simplify cached unencrypted_size skip condition to explicit == 0 check - Remove redundant !isset guard on new-file path Fix remaining > 0 / !== 0 guards that treated zero as "no unencrypted_size": - FileInfo constructor: use encrypted flag for rawSize (getSize(false) path) - FileInfo::addSubEntry: use encrypted flag for sub-mount accumulation - Cache::calculateFolderSizeInner: use encrypted column instead of > 0 Add tests covering zero-byte encrypted file scenarios: - FileInfoTest: getSize(true/false) for zero-byte encrypted files - CacheTest: getUnencryptedSize and calculateFolderSize with encrypted=1,size=0 - EncryptionTest: verifyUnencryptedSize data provider cases for header-only files Assisted-by: ClaudeCode:claude-opus-4-6 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Stephen Cuppett <scuppett@redhat.com>
…Byte test(encryption): strengthen testCalculateFolderSizeWithEncryptedZeroByte Add a second encrypted child with unencrypted_size=100 so the write-back gate in calculateFolderSizeInner ($unencryptedMax > 0) actually opens. The original single zero-byte child left the gate closed, meaning the test passed against the DB default rather than the computed value. With two children the assertion distinguishes the fixed code (result: 100) from the old buggy code (result: 8292, falling back to on-disk size for the zero-byte child). Assisted-by: ClaudeCode:claude-opus-4-6 Signed-off-by: Stephen Cuppett <scuppett@redhat.com> [skip ci]
cuppett
marked this pull request as ready for review
August 4, 2026 13:00
cuppett
requested review from
Altahrim,
nfebe and
sorbaugh
and removed request for
a team
August 4, 2026 13:00
cuppett
approved these changes
Aug 4, 2026
cuppett
left a comment
Contributor
There was a problem hiding this comment.
Had to add back a check that somehow got lost in the backport/cherry-pick, but added and validated that.
Aligns with the stable34 backport (#62780): the constructor still compared unencrypted_size against 0 instead of checking the encrypted flag, so getSize(false) fell back to the on-disk size for zero-byte encrypted files. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Stephen Cuppett <steve@cuppett.com>
cuppett
force-pushed
the
backport/60070/stable33
branch
from
August 4, 2026 16:56
551209f to
f3ebb6f
Compare
Contributor
|
I missed DCO sign off, had to force repush my last commit to patch up the backport. No other changes. |
AndyScherzinger
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport of #60070
Warning, This backport's changes differ from the original and might be incomplete⚠️
Todo
Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.