mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Merge pull request #40381 from nextcloud/backport/38808/stable25
This commit is contained in:
commit
f077b260be
4 changed files with 6 additions and 4 deletions
|
|
@ -134,7 +134,7 @@ class CacheEntry implements ICacheEntry {
|
|||
}
|
||||
|
||||
public function getUnencryptedSize(): int {
|
||||
if (isset($this->data['unencrypted_size']) && $this->data['unencrypted_size'] > 0) {
|
||||
if ($this->data['encrypted'] && isset($this->data['unencrypted_size']) && $this->data['unencrypted_size'] > 0) {
|
||||
return $this->data['unencrypted_size'];
|
||||
} else {
|
||||
return $this->data['size'] ?? 0;
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
|||
if ($includeMounts) {
|
||||
$this->updateEntryfromSubMounts();
|
||||
|
||||
if (isset($this->data['unencrypted_size']) && $this->data['unencrypted_size'] > 0) {
|
||||
if ($this->isEncrypted() && isset($this->data['unencrypted_size']) && $this->data['unencrypted_size'] > 0) {
|
||||
return $this->data['unencrypted_size'];
|
||||
} else {
|
||||
return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
|
||||
|
|
@ -232,7 +232,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
|||
* @return bool
|
||||
*/
|
||||
public function isEncrypted() {
|
||||
return $this->data['encrypted'];
|
||||
return $this->data['encrypted'] ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -521,6 +521,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
|
|||
}
|
||||
|
||||
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)) {
|
||||
|
|
|
|||
|
|
@ -1087,7 +1087,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…
Reference in a new issue