fix foldersize check to validate zip input size

This commit is contained in:
Arthur Schiwon 2013-03-08 19:21:06 +01:00
parent 2ae1ad23b0
commit f4a326173e
1 changed files with 11 additions and 5 deletions

View File

@ -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');