fix: Only store unencrypted_size if path should be encrypted

Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/38808/head
Julius Härtl 2 years ago
parent 00c0813ce6
commit 88a96e4db7
  1. 2
      lib/private/Files/ObjectStore/ObjectStoreStorage.php
  2. 2
      lib/private/Files/Storage/Wrapper/Encryption.php

@ -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)) {

@ -1071,7 +1071,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]);
}

Loading…
Cancel
Save