]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: Only store unencrypted_size if path should be encrypted
authorJulius Härtl <jus@bitgrid.net>
Wed, 14 Jun 2023 12:38:33 +0000 (14:38 +0200)
committerJulius Härtl <jus@bitgrid.net>
Tue, 12 Sep 2023 13:05:13 +0000 (15:05 +0200)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/Files/ObjectStore/ObjectStoreStorage.php
lib/private/Files/Storage/Wrapper/Encryption.php

index d918bd9872971234bd508a4437ef3b2cc5910dc3..4dceee9a58bbf92a5003cc4acceebf62472523ae 100644 (file)
@@ -559,6 +559,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
                }
 
                if ($exists) {
+                       // Always update the unencrypted size, for encryption the Encryption wrapper will update this afterwards anyways
+                       $stat['unencrypted_size'] = $stat['size'];
                        $this->getCache()->update($fileId, $stat);
                } else {
                        if (!$this->validateWrites || $this->objectStore->objectExists($urn)) {
index 2e69af269d467adc2537adc9664d8e17598eaf76..89e493b41fd900ef3d99f0e72878ea4199d93c0c 100644 (file)
@@ -1093,7 +1093,7 @@ class Encryption extends Wrapper {
 
                // object store, stores the size after write and doesn't update this during scan
                // manually store the unencrypted size
-               if ($result && $this->getWrapperStorage()->instanceOfStorage(ObjectStoreStorage::class)) {
+               if ($result && $this->getWrapperStorage()->instanceOfStorage(ObjectStoreStorage::class) && $this->shouldEncrypt($path)) {
                        $this->getCache()->put($path, ['unencrypted_size' => $count]);
                }