diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2013-03-08 19:21:06 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2013-03-08 19:21:06 +0100 |
commit | f4a326173e978e4b3491b23d27f8dcafdfbaff09 (patch) | |
tree | 00e3335a747c281d06aeaba626ac856c5d89f659 /lib/files.php | |
parent | 2ae1ad23b0722f827ca14bcac889dbfb9b6bf5d6 (diff) | |
download | nextcloud-server-f4a326173e978e4b3491b23d27f8dcafdfbaff09.tar.gz nextcloud-server-f4a326173e978e4b3491b23d27f8dcafdfbaff09.zip |
fix foldersize check to validate zip input size
Diffstat (limited to 'lib/files.php')
-rw-r--r-- | lib/files.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/files.php b/lib/files.php index b594b78c4b7..059c465792a 100644 --- a/lib/files.php +++ b/lib/files.php @@ -212,12 +212,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'); |