fix: possible test fix for subfolder redirect

isekai-main
Barış Soner Uşaklı 3 years ago
parent 3479832593
commit 3605ac811d

@ -164,15 +164,15 @@ authenticationController.registerComplete = async function (req, res) {
const done = function (data) {
delete req.session.registration;
const relative_path = nconf.get('relative_path');
if (data && data.message) {
return res.redirect(`${nconf.get('relative_path')}/?register=${encodeURIComponent(data.message)}`);
return res.redirect(`${relative_path}/?register=${encodeURIComponent(data.message)}`);
}
if (req.session.returnTo) {
res.redirect(nconf.get('relative_path') + req.session.returnTo);
res.redirect(relative_path + req.session.returnTo.replace(new RegExp(`^${relative_path}`), ''));
} else {
res.redirect(`${nconf.get('relative_path')}/`);
res.redirect(`${relative_path}/`);
}
};

@ -413,7 +413,7 @@ describe('Controllers', () => {
});
assert.strictEqual(res.statusCode, 302);
assert.strictEqual(res.headers.location, '/');
assert.strictEqual(res.headers.location, `${nconf.get('relative_path')}/`);
});
});

Loading…
Cancel
Save