]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix foldersize check to validate zip input size
authorArthur Schiwon <blizzz@owncloud.com>
Fri, 8 Mar 2013 18:21:06 +0000 (19:21 +0100)
committerArthur Schiwon <blizzz@owncloud.com>
Fri, 8 Mar 2013 18:21:06 +0000 (19:21 +0100)
lib/files.php

index b594b78c4b768d7225368859535a76eb07b62ddd..059c465792a71df604d296b25f350c097ed7844b 100644 (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');