From ce01fec55cfe4ec17fc18fd421c30d737aafa3c1 Mon Sep 17 00:00:00 2001 From: TemitopeAyokuHO Date: Tue, 23 Jul 2024 08:59:52 +0100 Subject: [PATCH] ACRS-211-Bugfix For over 1500 characters - I have added this changes to HOF framework version : 21.0.1 and 20.5.7-Beta-payload-too-large. - Added two variable in the config.js to allow a dynamic body parser size be increased by developer. --- config.js | 4 +++- package.json | 2 +- server.js | 7 ++++--- yarn.lock | 8 ++++---- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/config.js b/config.js index 7a59487d..0117a2cf 100644 --- a/config.js +++ b/config.js @@ -88,5 +88,7 @@ module.exports = { uniqueReferralRefs: { refLength: 6, refAllowedChars: 'ABCDEFGHJKMNPRTUVWXY0123456789' - } + }, + urlEncodedLimitSize : process.env.URL_ENCODED_LIMIT_SIZE || '2mb', + jsonLimitSize : process.env.JSON_LIMIT_SIZE || '2mb' }; diff --git a/package.json b/package.json index 0b6b6823..71a396ab 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "bytes": "^3.1.2", "crypto-random-string": "^5.0.0", "dotenv": "^16.3.1", - "hof": "~20.5.0", + "hof": "20.5.7-Beta-payload-too-large", "ioredis": "^5.4.1", "jquery": "^3.7.1", "lodash": "^4.17.21", diff --git a/server.js b/server.js index fc2102c8..3aec11b0 100644 --- a/server.js +++ b/server.js @@ -7,14 +7,15 @@ const _ = require('lodash'); const busboy = require('busboy'); const bl = require('bl'); const logger = require('hof/lib/logger')({ env: config.env }); - +const bodyParser = require('body-parser'); let settings = require('./hof.settings'); settings = Object.assign({}, settings, { routes: settings.routes.map(require), - behaviours: settings.behaviours.map(require) + behaviours: settings.behaviours.map(require), }); + if (!fs.existsSync(config.dataDirectory)) { fs.mkdirSync(config.dataDirectory); } @@ -26,7 +27,7 @@ app.use((req, res, next) => { const protocol = host.includes('localhost') ? 'http' : 'https'; res.locals.formUrl = `${protocol}://${host}`; res.locals.htmlLang = 'en'; - + next(); }); diff --git a/yarn.lock b/yarn.lock index 06b1cdf3..6124a732 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3121,10 +3121,10 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hof@~20.5.0: - version "20.5.2" - resolved "https://registry.yarnpkg.com/hof/-/hof-20.5.2.tgz#1a7a5660fd8a92991903619b18fca5c7e624201c" - integrity sha512-TdENaThMn36S6J2vpjRoujAEtJuDKmkwUEfuqVyXZFOqboFN1/nuC9NnYimKkcxvMxq61rWQDsmwNgO/wQN6cQ== +hof@20.5.7-Beta-payload-too-large: + version "20.5.7-Beta-payload-too-large" + resolved "https://registry.yarnpkg.com/hof/-/hof-20.5.7-Beta-payload-too-large.tgz#b04fb9ee3449eafad622a51668aa1eae174cdc58" + integrity sha512-9kFekPljshg5UpY0TUu80hsikWCM2ffl57NhNNZMpPaNSXapHnhl+TK3Lr7lDqJPWWLE14cewl5ICkP+thV8Lg== dependencies: aliasify "^2.1.0" bluebird "^3.7.2"