mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
🐛 Modify regex to allow subdir/ghost urls. (#8627)
no issue - redirect admin url's if Ghost uses a subdirectory - fixes a bug where reset password and invite links do not route to the right destination
This commit is contained in:
parent
21d7791eae
commit
c2e47f89ba
1 changed files with 4 additions and 1 deletions
|
@ -1,7 +1,10 @@
|
||||||
var utils = require('../utils');
|
var utils = require('../utils');
|
||||||
|
|
||||||
function redirectAdminUrls(req, res, next) {
|
function redirectAdminUrls(req, res, next) {
|
||||||
var ghostPathMatch = req.originalUrl.match(/^\/ghost\/(.+)$/);
|
var subdir = utils.url.getSubdir(),
|
||||||
|
ghostPathRegex = new RegExp('^' + subdir + '/ghost/(.+)'),
|
||||||
|
ghostPathMatch = req.originalUrl.match(ghostPathRegex);
|
||||||
|
|
||||||
if (ghostPathMatch) {
|
if (ghostPathMatch) {
|
||||||
return res.redirect(utils.url.urlJoin(utils.url.urlFor('admin'), '#', ghostPathMatch[1]));
|
return res.redirect(utils.url.urlJoin(utils.url.urlFor('admin'), '#', ghostPathMatch[1]));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue