mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Merge pull request #1728 from mjbshaw/clean-admin-regex
Don't use unnecessary (and unescaped) regex
This commit is contained in:
commit
bc29b14cde
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user