From ceaefc2c54f4a5d4528bf2e7ba4607297d2453f4 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 16 Feb 2016 12:39:44 +0100 Subject: Defer quota check in web UI when overwriting shared file When receiving a shared file, the quota for that file counts in the owner's storage, not the current user's storage. To make it possible to overwrite the file even when the current user doesn't have enough space, the quota check is deferred for such files. --- apps/files/ajax/upload.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'apps/files/ajax/upload.php') diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 5bf69d3e304..36aaed5ad9e 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -136,8 +136,12 @@ $maxUploadFileSize = $storageStats['uploadMaxFilesize']; $maxHumanFileSize = OCP\Util::humanFileSize($maxUploadFileSize); $totalSize = 0; -foreach ($files['size'] as $size) { - $totalSize += $size; +$isReceivedShare = \OC::$server->getRequest()->getParam('isReceivedShare', false) === 'true'; +// defer quota check for received shares +if (!$isReceivedShare) { + foreach ($files['size'] as $size) { + $totalSize += $size; + } } if ($maxUploadFileSize >= 0 and $totalSize > $maxUploadFileSize) { OCP\JSON::error(array('data' => array('message' => $l->t('Not enough storage available'), -- cgit v1.2.3