summaryrefslogtreecommitdiffstats
path: root/lib/files.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2013-03-08 10:31:48 -0800
committerLukas Reschke <lukas@statuscode.ch>2013-03-08 10:31:48 -0800
commit546fb72b25fb8ebdc70aa75ccc7a095d7d83b174 (patch)
tree93f80203c589000d9e7977bc75b6520bd9d55512 /lib/files.php
parentf9c24a0368876313205d988106b92ab052129b18 (diff)
parentf4a326173e978e4b3491b23d27f8dcafdfbaff09 (diff)
downloadnextcloud-server-546fb72b25fb8ebdc70aa75ccc7a095d7d83b174.tar.gz
nextcloud-server-546fb72b25fb8ebdc70aa75ccc7a095d7d83b174.zip
Merge pull request #2165 from owncloud/fix_2155
Offer download of whole shared dir only if it does not exceed zip input ...
Diffstat (limited to 'lib/files.php')
-rw-r--r--lib/files.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/files.php b/lib/files.php
index 447ffb50577..71bb21851b6 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -219,12 +219,18 @@ class OC_Files {
$zipLimit = OC_Config::getValue('maxZipInputSize', OC_Helper::computerFileSize('800 MB'));
if ($zipLimit > 0) {
$totalsize = 0;
- if (is_array($files)) {
- foreach ($files as $file) {
- $totalsize += \OC\Files\Filesystem::filesize($dir . '/' . $file);
+ if(!is_array($files)) {
+ $files = array($files);
+ }
+ foreach ($files as $file) {
+ $path = $dir . '/' . $file;
+ if(\OC\Files\Filesystem::is_dir($path)) {
+ foreach (\OC\Files\Filesystem::getDirectoryContent($path) as $i) {
+ $totalsize += $i['size'];
+ }
+ } else {
+ $totalsize += \OC\Files\Filesystem::filesize($path);
}
- } else {
- $totalsize += \OC\Files\Filesystem::filesize($dir . '/' . $files);
}
if ($totalsize > $zipLimit) {
$l = OC_L10N::get('lib');