import: introduce importMaxFileSize setting. Defaults to 50 MB

From Etherpad 1.8.3 onwards, the maximum allowed size for a single imported
file will always be bounded.

The maximum allowed size can be configured via importMaxFileSize.
pull/3740/head
John McLear 2020-04-07 01:07:10 +02:00 committed by muxator
parent d1ad29a3d1
commit f4418149cb
4 changed files with 25 additions and 0 deletions

View File

@ -408,6 +408,14 @@
"indentationOnNewLine": false, "indentationOnNewLine": false,
*/ */
/*
* From Etherpad 1.8.3 onwards, the maximum allowed size for a single imported
* file is always bounded.
*
* File size is specified in bytes. Default is 50 MB.
*/
"importMaxFileSize": 52428800, // 50 * 1024 * 1024
/* /*
* Toolbar buttons configuration. * Toolbar buttons configuration.
* *

View File

@ -413,6 +413,14 @@
"indentationOnNewLine": false, "indentationOnNewLine": false,
*/ */
/*
* From Etherpad 1.8.3 onwards, the maximum allowed size for a single imported
* file is always bounded.
*
* File size is specified in bytes. Default is 50 MB.
*/
"importMaxFileSize": 52428800, // 50 * 1024 * 1024
/* /*
* Toolbar buttons configuration. * Toolbar buttons configuration.
* *

View File

@ -72,6 +72,7 @@ async function doImport(req, res, padId)
let form = new formidable.IncomingForm(); let form = new formidable.IncomingForm();
form.keepExtensions = true; form.keepExtensions = true;
form.uploadDir = tmpDirectory; form.uploadDir = tmpDirectory;
form.maxFileSize = settings.importMaxFileSize;
// locally wrapped Promise, since form.parse requires a callback // locally wrapped Promise, since form.parse requires a callback
let srcFile = await new Promise((resolve, reject) => { let srcFile = await new Promise((resolve, reject) => {

View File

@ -305,6 +305,14 @@ exports.scrollWhenFocusLineIsOutOfViewport = {
*/ */
exports.exposeVersion = false; exports.exposeVersion = false;
/*
* From Etherpad 1.8.3 onwards, the maximum allowed size for a single imported
* file is always bounded.
*
* File size is specified in bytes. Default is 50 MB.
*/
exports.importMaxFileSize = 50 * 1024 * 1024;
// checks if abiword is avaiable // checks if abiword is avaiable
exports.abiwordAvailable = function() exports.abiwordAvailable = function()
{ {