diff options
author | Julius Härtl <jus@bitgrid.net> | 2023-06-14 14:39:15 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2023-09-12 15:05:16 +0200 |
commit | fd6990a33b5ca01f082944ecd379246e3406aab2 (patch) | |
tree | 46fc88d63304dcf09c8e7f7b8c592004bd772e64 | |
parent | b14967cb2cd767f52ed61347ac8ee768d909aad7 (diff) | |
download | nextcloud-server-fd6990a33b5ca01f082944ecd379246e3406aab2.tar.gz nextcloud-server-fd6990a33b5ca01f082944ecd379246e3406aab2.zip |
fix: Only read unencrypted_size when file is actually encrypted
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | lib/private/Files/Cache/CacheEntry.php | 2 | ||||
-rw-r--r-- | lib/private/Files/FileInfo.php | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/Files/Cache/CacheEntry.php b/lib/private/Files/Cache/CacheEntry.php index ce9df2823c8..d1a64552fd1 100644 --- a/lib/private/Files/Cache/CacheEntry.php +++ b/lib/private/Files/Cache/CacheEntry.php @@ -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; diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index b3c4629e2b2..09a29113485 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -205,7 +205,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; @@ -227,7 +227,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @return bool */ public function isEncrypted() { - return $this->data['encrypted']; + return $this->data['encrypted'] ?? false; } /** |