diff options
author | Richard Steinmetz <richard@steinmetz.cloud> | 2023-07-03 09:40:46 +0200 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-07-04 20:18:17 +0000 |
commit | aaa7b41a33ce87f2262eba57d765b73fd8cadffe (patch) | |
tree | d527e298800b47672eea13d4cdf86990dcf64f24 /lib/private/Files/Storage/Wrapper | |
parent | dd2dfc89fd34b1c7c3f38e33b5942f2a57fafc7a (diff) | |
download | nextcloud-server-aaa7b41a33ce87f2262eba57d765b73fd8cadffe.tar.gz nextcloud-server-aaa7b41a33ce87f2262eba57d765b73fd8cadffe.zip |
fix(sse): don't update uncached files
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'lib/private/Files/Storage/Wrapper')
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encryption.php | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 9c0e6c91463..2e69af269d4 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -17,6 +17,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Tigran Mkrtchyan <tigran.mkrtchyan@desy.de> * @author Vincent Petry <vincent@nextcloud.com> + * @author Richard Steinmetz <richard@steinmetz.cloud> * * @license AGPL-3.0 * @@ -143,21 +144,28 @@ class Encryption extends Wrapper { } 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)) { + $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; |