diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-07-06 18:42:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-06 18:42:29 +0200 |
commit | d2be510ff134bd5934c2857be82027945bf081c9 (patch) | |
tree | 630553f5d6791e76865a02a6c66316d4ec33b99b /lib | |
parent | 1bdbb39eccedad577a0fb7d46777d0f2990e02da (diff) | |
parent | aaa7b41a33ce87f2262eba57d765b73fd8cadffe (diff) | |
download | nextcloud-server-d2be510ff134bd5934c2857be82027945bf081c9.tar.gz nextcloud-server-d2be510ff134bd5934c2857be82027945bf081c9.zip |
Merge pull request #39151 from nextcloud/backport/39115/stable27
[stable27] fix(sse): don't update uncached files
Diffstat (limited to 'lib')
-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; |