]> source.dussan.org Git - nextcloud-server.git/commitdiff
return size from cache in case the cache entry is marked as encrypted
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 14 Apr 2015 10:44:51 +0000 (12:44 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 14 Apr 2015 11:08:59 +0000 (13:08 +0200)
lib/private/files/storage/wrapper/encryption.php

index 47a31e794e87dc0a062fd0c29b8b6ad98516c9d9..5697139bd6bf927056a1f6858b50f27be10ca631 100644 (file)
@@ -91,21 +91,23 @@ class Encryption extends Wrapper {
         */
        public function filesize($path) {
                $fullPath = $this->getFullPath($path);
-               $size = $this->storage->filesize($path);
 
                $info = $this->getCache()->get($path);
-
                if (isset($this->unencryptedSize[$fullPath])) {
                        $size = $this->unencryptedSize[$fullPath];
-               }
 
-               if (isset($info['fileid'])) {
-                       $info['encrypted'] = true;
-                       $info['size'] = $size;
-                       $this->getCache()->put($path, $info);
+                       if (isset($info['fileid'])) {
+                               $info['encrypted'] = true;
+                               $info['size'] = $size;
+                               $this->getCache()->put($path, $info);
+                       }
+                       return $size;
                }
 
-               return $size;
+               if (isset($info['fileid']) && $info['encrypted']) {
+                       return $info['size'];
+               }
+               return $this->storage->filesize($path);
        }
 
        /**