diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2013-03-08 10:31:48 -0800 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2013-03-08 10:31:48 -0800 |
commit | 546fb72b25fb8ebdc70aa75ccc7a095d7d83b174 (patch) | |
tree | 93f80203c589000d9e7977bc75b6520bd9d55512 /apps | |
parent | f9c24a0368876313205d988106b92ab052129b18 (diff) | |
parent | f4a326173e978e4b3491b23d27f8dcafdfbaff09 (diff) | |
download | nextcloud-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 'apps')
-rw-r--r-- | apps/files_sharing/public.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index e345b91e293..1da972ad7e3 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -141,7 +141,9 @@ if (isset($path)) { OCP\Util::addscript('files', 'keyboardshortcuts'); $files = array(); $rootLength = strlen($basePath) + 1; + $totalSize = 0; foreach (\OC\Files\Filesystem::getDirectoryContent($path) as $i) { + $totalSize += $i['size']; $i['date'] = OCP\Util::formatDate($i['mtime']); if ($i['type'] == 'file') { $fileinfo = pathinfo($i['name']); @@ -188,7 +190,9 @@ if (isset($path)) { $folder->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); $folder->assign('usedSpacePercent', 0); $tmpl->assign('folder', $folder->fetchPage()); - $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); + $allowZip = OCP\Config::getSystemValue('allowZipDownload', true) + && $totalSize <= OCP\Config::getSystemValue('maxZipInputSize', OCP\Util::computerFileSize('800 MB')); + $tmpl->assign('allowZipDownload', intval($allowZip)); $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath)); } else { |