diff --git a/settings.json.docker b/settings.json.docker index b33b0f0e4..56677274f 100644 --- a/settings.json.docker +++ b/settings.json.docker @@ -408,6 +408,14 @@ "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. * diff --git a/settings.json.template b/settings.json.template index f714f9a21..97ed7844b 100644 --- a/settings.json.template +++ b/settings.json.template @@ -413,6 +413,14 @@ "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. * diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 02ef92635..e3bdcb1c6 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -72,6 +72,7 @@ async function doImport(req, res, padId) let form = new formidable.IncomingForm(); form.keepExtensions = true; form.uploadDir = tmpDirectory; + form.maxFileSize = settings.importMaxFileSize; // locally wrapped Promise, since form.parse requires a callback let srcFile = await new Promise((resolve, reject) => { diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index 2d519d0ab..4c808620b 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -305,6 +305,14 @@ exports.scrollWhenFocusLineIsOutOfViewport = { */ 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 exports.abiwordAvailable = function() {