From a1b794ad288b639372ebf639065ca54cefe29fce Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 8 Sep 2016 14:29:20 +0200 Subject: [PATCH] Remove upload_limit in files app as it is not needed with PUT upload The web UI now uses for PUT uploads which aren't restricted by PHP's upload_max_filesize and post_max_size --- apps/files/js/file-upload.js | 15 +-------------- apps/files/js/files.js | 2 -- apps/files/list.php | 2 -- apps/files/templates/list.php | 2 -- apps/files/tests/js/fileUploadSpec.js | 14 -------------- .../lib/Controllers/ShareController.php | 4 +--- 6 files changed, 2 insertions(+), 37 deletions(-) diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index b82f78d23bca..534f2bd5d9a2 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -768,8 +768,7 @@ OC.Uploader.prototype = _.extend({ data.originalFiles.selection = { uploads: [], filesToUpload: data.originalFiles.length, - totalBytes: 0, - biggestFileBytes: 0 + totalBytes: 0 }; } // TODO: move originalFiles to a separate container, maybe inside OC.Upload @@ -828,18 +827,6 @@ OC.Uploader.prototype = _.extend({ } else { // add size selection.totalBytes += file.size; - // update size of biggest file - selection.biggestFileBytes = Math.max(selection.biggestFileBytes, file.size); - } - - // check PHP upload limit against biggest file - if (selection.biggestFileBytes > $('#upload_limit').val()) { - data.textStatus = 'sizeexceedlimit'; - data.errorThrown = t('files', - 'Total file size {size1} exceeds upload limit {size2}', { - 'size1': humanFileSize(selection.biggestFileBytes), - 'size2': humanFileSize($('#upload_limit').val()) - }); } // check free space diff --git a/apps/files/js/files.js b/apps/files/js/files.js index b525ecdaed01..11c54179fcf1 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -59,7 +59,6 @@ return; } if (response.data !== undefined && response.data.uploadMaxFilesize !== undefined) { - $('#max_upload').val(response.data.uploadMaxFilesize); $('#free_space').val(response.data.freeSpace); $('#upload.button').attr('data-original-title', response.data.maxHumanFilesize); $('#usedSpacePercent').val(response.data.usedSpacePercent); @@ -71,7 +70,6 @@ return; } if (response[0].uploadMaxFilesize !== undefined) { - $('#max_upload').val(response[0].uploadMaxFilesize); $('#upload.button').attr('data-original-title', response[0].maxHumanFilesize); $('#usedSpacePercent').val(response[0].usedSpacePercent); Files.displayStorageWarnings(); diff --git a/apps/files/list.php b/apps/files/list.php index 14f3c03b3cf2..198e44e00c64 100644 --- a/apps/files/list.php +++ b/apps/files/list.php @@ -26,11 +26,9 @@ $config = \OC::$server->getConfig(); // TODO: move this to the generated config.js $publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'); -$uploadLimit=OCP\Util::uploadLimit(); // renders the controls and table headers template $tmpl = new OCP\Template('files', 'list', ''); -$tmpl->assign('uploadLimit', $uploadLimit); // PHP upload limit $tmpl->assign('publicUploadEnabled', $publicUploadEnabled); $tmpl->printPage(); diff --git a/apps/files/templates/list.php b/apps/files/templates/list.php index e741849f38bb..d66f12f4aff0 100644 --- a/apps/files/templates/list.php +++ b/apps/files/templates/list.php @@ -15,8 +15,6 @@ through ajax instead (updateStorageStatistics). */ ?> - - diff --git a/apps/files/tests/js/fileUploadSpec.js b/apps/files/tests/js/fileUploadSpec.js index 19f8cde7e442..fa686dbf3e25 100644 --- a/apps/files/tests/js/fileUploadSpec.js +++ b/apps/files/tests/js/fileUploadSpec.js @@ -35,7 +35,6 @@ describe('OC.Upload tests', function() { // need a dummy button because file-upload checks on it $('#testArea').append( '' + - '' + // 10 MB '' + // 50 MB // TODO: handlebars! '
' + @@ -97,19 +96,6 @@ describe('OC.Upload tests', function() { expect(result[0].submit.calledOnce).toEqual(true); expect(failStub.notCalled).toEqual(true); }); - it('does not add file if it exceeds upload limit', function() { - var result; - $('#upload_limit').val(1000); - - result = addFiles(uploader, [testFile]); - - expect(result[0]).toEqual(null); - expect(failStub.calledOnce).toEqual(true); - expect(failStub.getCall(0).args[1].textStatus).toEqual('sizeexceedlimit'); - expect(failStub.getCall(0).args[1].errorThrown).toEqual( - 'Total file size 5 KB exceeds upload limit 1000 B' - ); - }); it('does not add file if it exceeds free space', function() { var result; $('#free_space').val(1000); diff --git a/apps/files_sharing/lib/Controllers/ShareController.php b/apps/files_sharing/lib/Controllers/ShareController.php index a5d5e554d876..c766b9770b93 100644 --- a/apps/files_sharing/lib/Controllers/ShareController.php +++ b/apps/files_sharing/lib/Controllers/ShareController.php @@ -327,8 +327,7 @@ public function showShare($token, $path = '') { $freeSpace = (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188 } - $uploadLimit = Util::uploadLimit(); - $maxUploadFilesize = min($freeSpace, $uploadLimit); + $maxUploadFilesize = $freeSpace; $folder = new Template('files', 'list', ''); $folder->assign('dir', $rootFolder->getRelativePath($path->getPath())); @@ -339,7 +338,6 @@ public function showShare($token, $path = '') { $folder->assign('uploadMaxFilesize', $maxUploadFilesize); $folder->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); $folder->assign('freeSpace', $freeSpace); - $folder->assign('uploadLimit', $uploadLimit); // PHP upload limit $folder->assign('usedSpacePercent', 0); $folder->assign('trash', false); $shareTmpl['folder'] = $folder->fetchPage();