Skip to content

Commit

Permalink
🐛 Modify regex to allow subdir/ghost urls. (#8627)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
patrickkim authored and kirrg001 committed Jun 27, 2017
1 parent 21d7791 commit c2e47f8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/server/admin/middleware.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
var utils = require('../utils');

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) {
return res.redirect(utils.url.urlJoin(utils.url.urlFor('admin'), '#', ghostPathMatch[1]));
}
Expand Down

0 comments on commit c2e47f8

Please sign in to comment.