Skip to content

Commit b80eb6b

Browse files
committed
Parse shareMaxRequestSize
1 parent 13b5f98 commit b80eb6b

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

lib/controllers/serverconfig.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* jshint node: true, esnext: true */
22
"use strict";
33
var express = require('express');
4+
var bytes = require('bytes');
45

56
// Expose a whitelisted set of configuration attributes to the world. This definitely doesn't include authorisation tokens, local file paths, etc.
67
// It mirrors the structure of the real config file.
@@ -19,6 +20,9 @@ module.exports = function(options) {
1920
if (settings.feedback && settings.feedback.additionalParameters) {
2021
safeSettings.additionalFeedbackParameters = settings.feedback.additionalParameters;
2122
}
23+
if (settings.shareMaxRequestSize) {
24+
safeSettings.shareMaxRequestSizeBytes = bytes.parse(settings.shareMaxRequestSize);
25+
}
2226

2327
router.get('/', function(req, res, next) {
2428
res.status(200).send(safeSettings);

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"base-x": "^5.0.1",
3737
"basic-auth": "^2.0.1",
3838
"body-parser": "^1.20.3",
39+
"bytes": "^3.1.2",
3940
"compression": "^1.6.0",
4041
"cors": "^2.7.1",
4142
"express": "^4.21.2",

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ bytes@3.0.0:
208208
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
209209
integrity sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==
210210

211-
bytes@3.1.2:
211+
bytes@3.1.2, bytes@^3.1.2:
212212
version "3.1.2"
213213
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5"
214214
integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==

0 commit comments

Comments
 (0)