Skip to content
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(sse): don't update uncached files #39115

Merged
merged 1 commit into from
Jul 4, 2023
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
34 changes: 21 additions & 13 deletions lib/private/Files/Storage/Wrapper/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @author Thomas Müller <[email protected]>
* @author Tigran Mkrtchyan <[email protected]>
* @author Vincent Petry <[email protected]>
* @author Richard Steinmetz <[email protected]>
*
* @license AGPL-3.0
*
Expand Down Expand Up @@ -143,21 +144,28 @@ public function filesize($path): false|int|float {
}
if (isset($this->unencryptedSize[$fullPath])) {
$size = $this->unencryptedSize[$fullPath];
// update file cache
if ($info instanceof ICacheEntry) {
$info['encrypted'] = $info['encryptedVersion'];
} else {
if (!is_array($info)) {
$info = [];

// Update file cache (only if file is already cached).
// Certain files are not cached (e.g. *.part).
if (isset($info['fileid'])) {
if ($info instanceof ICacheEntry) {
$info['encrypted'] = $info['encryptedVersion'];
} else {
/**
* @psalm-suppress RedundantCondition
*/
if (!is_array($info)) {
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Show resolved Hide resolved
$info = [];
}
$info['encrypted'] = true;
$info = new CacheEntry($info);
}
$info['encrypted'] = true;
$info = new CacheEntry($info);
}

if ($size !== $info->getUnencryptedSize()) {
$this->getCache()->update($info->getId(), [
'unencrypted_size' => $size
]);
if ($size !== $info->getUnencryptedSize()) {
$this->getCache()->update($info->getId(), [
'unencrypted_size' => $size
]);
}
}

return $size;
Expand Down