diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/ajax/delete.php | 2 | ||||
-rw-r--r-- | apps/files/js/file-upload.js | 2 | ||||
-rw-r--r-- | apps/files_encryption/lib/proxy.php | 7 | ||||
-rw-r--r-- | apps/files_encryption/tests/proxy.php | 20 |
4 files changed, 29 insertions, 2 deletions
diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php index 69f859daa97..99f49188384 100644 --- a/apps/files/ajax/delete.php +++ b/apps/files/ajax/delete.php @@ -9,7 +9,7 @@ OCP\JSON::callCheck(); // Get data $dir = stripslashes($_POST["dir"]); $files = isset($_POST["file"]) ? $_POST["file"] : $_POST["files"]; -$allFiles = isset($_POST["allfiles"]) ? $_POST["allfiles"] : $_POST["allfiles"]; +$allFiles = isset($_POST["allfiles"]) ? $_POST["allfiles"] : false; if ($allFiles === 'true') { $allFiles = true; } diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index b7b8f6fdeb6..ea4061c9b0b 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -180,7 +180,7 @@ OC.Upload = { }, init: function() { - if ( $('#file_upload_start').exists() ) { + if ( $('#file_upload_start').exists() && $('#file_upload_start').is(':visible')) { var file_upload_param = { dropZone: $('#content'), // restrict dropZone to content div diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index a2d42c22c13..b7e1599c1fe 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -340,6 +340,13 @@ class Proxy extends \OC_FileProxy { // if path is a folder do nothing if ($view->is_dir($path)) { + $proxyState = \OC_FileProxy::$enabled; + \OC_FileProxy::$enabled = false; + $fileInfo = $view->getFileInfo($path); + \OC_FileProxy::$enabled = $proxyState; + if ($fileInfo['unencrypted_size'] > 0) { + return $fileInfo['unencrypted_size']; + } return $size; } diff --git a/apps/files_encryption/tests/proxy.php b/apps/files_encryption/tests/proxy.php index 51cc0b795e3..647ee955eb1 100644 --- a/apps/files_encryption/tests/proxy.php +++ b/apps/files_encryption/tests/proxy.php @@ -112,4 +112,24 @@ class Test_Encryption_Proxy extends \PHPUnit_Framework_TestCase { } + function testPostFileSizeWithDirectory() { + + $this->view->file_put_contents($this->filename, $this->data); + + \OC_FileProxy::$enabled = false; + + // get root size, must match the file's unencrypted size + $unencryptedSize = $this->view->filesize(''); + + \OC_FileProxy::$enabled = true; + + $encryptedSize = $this->view->filesize(''); + + $this->assertTrue($encryptedSize !== $unencryptedSize); + + // cleanup + $this->view->unlink($this->filename); + + } + } |