diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2023-07-04 22:12:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-04 22:12:33 +0200 |
commit | bacd14a790c78724f25aea4298f6ac7e873c3b68 (patch) | |
tree | cffdfbaf82ce91a4c153bda85b676d3f8a5f1ba2 | |
parent | a8e2256114653cd3ad66d1a7951df9f2d69b2183 (diff) | |
parent | c4eccbb304acb095291ef2417ecdb9cc9c7bef9a (diff) | |
download | nextcloud-server-bacd14a790c78724f25aea4298f6ac7e873c3b68.tar.gz nextcloud-server-bacd14a790c78724f25aea4298f6ac7e873c3b68.zip |
Merge pull request #39115 from nextcloud/fix/unecrypted-size-part-files
fix(sse): don't update uncached files
-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 ab3873a7ec0..a27f499a210 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; |