From a05e8198c93ace093aa01ff23222890b831275a2 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 19 Nov 2020 03:19:13 -0500 Subject: [PATCH] bugfix: Fix bad paren placement in `/javascript` handler (#4496) * Fix bad paren placement in `/javascript` handler This fixes a bug introduced in commit ed5a635f4c113ba7a535b51b30245adc5cfb6cf0. * add regression test for #4495 * Move `/javascript` test to `specialpages.js` Co-authored-by: webzwo0i --- src/node/hooks/express/specialpages.js | 2 +- tests/backend/specs/specialpages.js | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/backend/specs/specialpages.js diff --git a/src/node/hooks/express/specialpages.js b/src/node/hooks/express/specialpages.js index eb5c4a7fe..864d67995 100644 --- a/src/node/hooks/express/specialpages.js +++ b/src/node/hooks/express/specialpages.js @@ -20,7 +20,7 @@ exports.expressCreateServer = function (hook_name, args, cb) { //serve javascript.html args.app.get('/javascript', function(req, res) { - res.send(eejs.require('ep_etherpad-lite/templates/javascript.html'), {req}); + res.send(eejs.require('ep_etherpad-lite/templates/javascript.html', {req})); }); diff --git a/tests/backend/specs/specialpages.js b/tests/backend/specs/specialpages.js new file mode 100644 index 000000000..89f23bd9b --- /dev/null +++ b/tests/backend/specs/specialpages.js @@ -0,0 +1,25 @@ +const common = require('../common'); +const settings = require('ep_etherpad-lite/node/utils/Settings'); + +describe(__filename, function() { + let agent; + const backups = {}; + before(async function() { agent = await common.init(); }); + beforeEach(async function() { + backups.settings = {}; + for (const setting of ['requireAuthentication', 'requireAuthorization']) { + backups.settings[setting] = settings[setting]; + } + settings.requireAuthentication = false; + settings.requireAuthorization = false; + }); + afterEach(async function() { + Object.assign(settings, backups.settings); + }); + + describe('/javascript', function() { + it('/javascript -> 200', async function() { + await agent.get('/javascript').expect(200); + }); + }); +});