summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-07-06 18:42:59 +0200
committerGitHub <noreply@github.com>2023-07-06 18:42:59 +0200
commite4e608caac2e335b4fb4f29f35f79c36808d0793 (patch)
treec2baec622ebd31704d6510f2996ca119030f8c7f
parentddfe6cc49c7e8bc06baa8e94cfd92f54c9f3c040 (diff)
parent36b48dea52a35e19941fb52f4a0f6606fbf2eb8e (diff)
downloadnextcloud-server-e4e608caac2e335b4fb4f29f35f79c36808d0793.tar.gz
nextcloud-server-e4e608caac2e335b4fb4f29f35f79c36808d0793.zip
Merge pull request #39152 from nextcloud/backport/39115/stable26
[stable26] fix(sse): don't update uncached files
-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 4d860e623e0..43960dfe612 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
*
@@ -141,21 +142,28 @@ class Encryption extends Wrapper {
$info = $this->getCache()->get($path);
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;