-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(files_versions): Update unencrypted_size
during rollback
#50299
base: master
Are you sure you want to change the base?
Conversation
/backport to stable30 |
/backport to stable29 |
/backport to stable28 |
Signed-off-by: Louis Chemineau <[email protected]>
This prevent restored version of encrypted files from having a wrong reported size. This was blocking download. Signed-off-by: Louis Chemineau <[email protected]>
a98900b
to
9a88f24
Compare
'size' => $oldFileInfo->getSize(), | ||
'unencrypted_size' => $oldFileInfo->getSize(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then is that the correct size? If versions are encrypted then size
and unencrypted_size
should be different, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. getSize()
return the unencrypted_size
if the file is encrypted:
server/lib/private/Files/FileInfo.php
Lines 176 to 189 in 5ef8b35
public function getSize($includeMounts = true) { | |
if ($includeMounts) { | |
$this->updateEntryFromSubMounts(); | |
if ($this->isEncrypted() && isset($this->data['unencrypted_size']) && $this->data['unencrypted_size'] > 0) { | |
return $this->data['unencrypted_size']; | |
} else { | |
return isset($this->data['size']) ? 0 + $this->data['size'] : 0; | |
} | |
} else { | |
return $this->rawSize; | |
} | |
} | |
But not sure how to properly get the size, then. Or maybe we should set size
or unencrypted_size
depending on the encryption status.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, no, if we do that size
will not be updated. But not even use size
if the file is encrypted
/backport to stable31 |
This prevents restored versions of encrypted files from having a wrong reported size. This was blocking download.