0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Don't use unnecessary (and unescaped) regex

closes #1731
This commit is contained in:
Michael Bradshaw 2013-12-21 14:15:22 -07:00
parent e9e99371a6
commit 7ee3235a68

View file

@ -118,12 +118,7 @@ function activateTheme(activeTheme) {
// Uses the URL to detect whether this response should be an admin response
// This is used to ensure the right content is served, and is not for security purposes
function manageAdminAndTheme(req, res, next) {
// TODO improve this regex
if (config.paths().path === '/') {
res.isAdmin = /(^\/ghost\/)/.test(req.url);
} else {
res.isAdmin = new RegExp("^\\" + config.paths().path + "\\/ghost\\/").test(req.url);
}
res.isAdmin = req.url.lastIndexOf(config.paths().webroot + '/ghost/', 0) === 0;
if (res.isAdmin) {
expressServer.enable('admin');