[Pkg-owncloud-commits] [owncloud] 376/394: Offer download of whole shared dir only if it does not exceed zip input limit
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:12:54 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.
commit 73d6a5524574309137eef29648fa5e7141696753
Author: Arthur Schiwon <blizzz at owncloud.com>
Date: Sat Mar 9 14:08:21 2013 +0100
Offer download of whole shared dir only if it does not exceed zip input limit
---
apps/files_sharing/public.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index a91efce..f4fd6ce 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -211,7 +211,9 @@ if ($linkItem) {
OCP\Util::addScript('files', 'filelist');
$files = array();
$rootLength = strlen($basePath) + 1;
+ $totalSize = 0;
foreach (OC_Files::getDirectoryContent($path) as $i) {
+ $totalSize += $i['size'];
$i['date'] = OCP\Util::formatDate($i['mtime']);
if ($i['type'] == 'file') {
$fileinfo = pathinfo($i['name']);
@@ -259,7 +261,9 @@ if ($linkItem) {
$folder->assign('uploadMaxHumanFilesize', 0);
$folder->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
$tmpl->assign('folder', $folder->fetchPage(), false);
- $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 {
// Show file preview if viewer is available
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list