bugfix: Fix bad paren placement in /javascript handler (#4496)

* Fix bad paren placement in `/javascript` handler

This fixes a bug introduced in commit
ed5a635f4c.

* add regression test for #4495

* Move `/javascript` test to `specialpages.js`

Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
This commit is contained in:
Richard Hansen 2020-11-19 03:19:13 -05:00 committed by GitHub
parent 07bcbbd404
commit a05e8198c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View file

@ -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}));
});

View file

@ -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);
});
});
});