Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Only store unencrypted_size if path should be encrypted
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Sep 12, 2023
commit 20de8f59430467f0d80ae29f4df9df8a25ec13b8
2 changes: 2 additions & 0 deletions lib/private/Files/ObjectStore/ObjectStoreStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ public function writeStream(string $path, $stream, int $size = null): int {
}

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->objectStore->objectExists($urn)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Storage/Wrapper/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ public function writeStream(string $path, $stream, int $size = null): int {

// 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]);
}

Expand Down