summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2023-07-03 09:40:46 +0200
committerRichard Steinmetz <richard@steinmetz.cloud>2023-07-04 12:42:29 +0200
commitc4eccbb304acb095291ef2417ecdb9cc9c7bef9a (patch)
tree419bcdc78d6874a7861dba5fd61e32d5cd86d581 /lib
parent2c71a77f4bd35bf68674be8b0fcff6f9f3c42200 (diff)
downloadnextcloud-server-c4eccbb304acb095291ef2417ecdb9cc9c7bef9a.tar.gz
nextcloud-server-c4eccbb304acb095291ef2417ecdb9cc9c7bef9a.zip
fix(sse): don't update uncached files
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php34
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;