Cleaned up duplicate middleware

refs 621cfd9866

- this file was meant to be moved to a folder in the referenced commit,
  but that never happened
- this commit fixes that
This commit is contained in:
Daniel Lockyer 2023-02-27 18:02:40 +01:00
parent 1a04e75e8b
commit 025ebb7890
No known key found for this signature in database

View File

@ -1,17 +0,0 @@
const urlUtils = require('../../../shared/url-utils');
function redirectAdminUrls(req, res, next) {
const subdir = urlUtils.getSubdir();
const ghostPathRegex = new RegExp(`^${subdir}/ghost/(.+)`);
const ghostPathMatch = req.originalUrl.match(ghostPathRegex);
if (ghostPathMatch) {
return res.redirect(urlUtils.urlJoin(urlUtils.urlFor('admin'), '#', ghostPathMatch[1]));
}
next();
}
module.exports = [
redirectAdminUrls
];