From 68a0ff08eaab0fc0f7752c4715eb8a3fea92a4af Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 8 Jan 2019 16:19:25 +0000 Subject: [PATCH] Merge pull request #1366 from sharelatex/ho-bump-compile-size Bump compile size GitOrigin-RevId: 087e8556a7e2e39bed486cdd8829bf427aaed68b --- .../web/app/coffee/Features/Compile/ClsiFormatChecker.coffee | 5 +++-- services/web/config/settings.defaults.coffee | 2 ++ .../test/unit/coffee/Compile/ClsiFormatCheckerTests.coffee | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/services/web/app/coffee/Features/Compile/ClsiFormatChecker.coffee b/services/web/app/coffee/Features/Compile/ClsiFormatChecker.coffee index b285d0e6b7..81807baf70 100644 --- a/services/web/app/coffee/Features/Compile/ClsiFormatChecker.coffee +++ b/services/web/app/coffee/Features/Compile/ClsiFormatChecker.coffee @@ -1,5 +1,6 @@ _ = require("lodash") async = require("async") +settings = require("settings-sharelatex") module.exports = ClsiFormatChecker = @@ -39,7 +40,7 @@ module.exports = ClsiFormatChecker = _checkDocsAreUnderSizeLimit: (resources, callback)-> - FIVEMB = 1000 * 1000 * 5 + sizeLimit = 1000 * 1000 * settings.compileBodySizeLimitMb totalSize = 0 @@ -53,7 +54,7 @@ module.exports = ClsiFormatChecker = totalSize += result.size return result - tooLarge = totalSize > FIVEMB + tooLarge = totalSize > sizeLimit if !tooLarge return callback() else diff --git a/services/web/config/settings.defaults.coffee b/services/web/config/settings.defaults.coffee index e89d3043e5..20aed0fdcb 100644 --- a/services/web/config/settings.defaults.coffee +++ b/services/web/config/settings.defaults.coffee @@ -488,6 +488,8 @@ module.exports = settings = # currentImage: "texlive-full:2017.1" # imageRoot: "" # without any trailing slash + + compileBodySizeLimitMb: process.env['COMPILE_BODY_SIZE_LIMIT_MB'] or 5 # allowedImageNames: [ # {imageName: 'texlive-full:2017.1', imageDesc: 'TeXLive 2017'} diff --git a/services/web/test/unit/coffee/Compile/ClsiFormatCheckerTests.coffee b/services/web/test/unit/coffee/Compile/ClsiFormatCheckerTests.coffee index d2f1c5ef3a..e24296060e 100644 --- a/services/web/test/unit/coffee/Compile/ClsiFormatCheckerTests.coffee +++ b/services/web/test/unit/coffee/Compile/ClsiFormatCheckerTests.coffee @@ -8,7 +8,7 @@ SandboxedModule = require('sandboxed-module') describe "ClsiFormatChecker", -> beforeEach -> @ClsiFormatChecker = SandboxedModule.require modulePath, requires: - "settings-sharelatex": @settings ={} + "settings-sharelatex": @settings = { compileBodySizeLimitMb: 5 } "logger-sharelatex": @logger = { log: sinon.stub(), error: sinon.stub(), warn: sinon.stub() } @project_id = "project-id"