]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix for extstorage + encryption where unencrypted size is not kept
authorVincent Petry <pvince81@owncloud.com>
Wed, 20 Nov 2013 15:20:21 +0000 (16:20 +0100)
committerVincent Petry <pvince81@owncloud.com>
Wed, 20 Nov 2013 15:22:55 +0000 (16:22 +0100)
Fix for external storage with encryption where the unencrypted size is
first written in the DB, then set back to zero, causing performance
issue because the file needs to be reopened every time to find out the
unencrypted size (and potentially needs a full redownload)

apps/files_encryption/lib/proxy.php
apps/files_encryption/lib/stream.php

index 54c3b9caa156a68a74e258623ac90dfe580948e3..a8c74bd9dd4cc2da90550fda3d5991b93654e10c 100644 (file)
@@ -349,7 +349,10 @@ class Proxy extends \OC_FileProxy {
                $fileInfo = false;
                // get file info from database/cache if not .part file
                if (!Helper::isPartialFilePath($path)) {
+                       $proxyState = \OC_FileProxy::$enabled;
+                       \OC_FileProxy::$enabled = false;
                        $fileInfo = $view->getFileInfo($path);
+                       \OC_FileProxy::$enabled = $proxyState;
                }
 
                // if file is encrypted return real file size
index 1738955d1aa9bb5944f851284d7433bd405dcba3..1f4f14d7fe5d85a8703cf1c4631dc58f586e4adb 100644 (file)
@@ -491,7 +491,8 @@ class Stream {
                if (
                                $this->meta['mode'] !== 'r' &&
                                $this->meta['mode'] !== 'rb' &&
-                               $this->size > 0
+                               $this->size > 0 &&
+                               $this->unencryptedSize > 0
                ) {
 
                        // only write keyfiles if it was a new file