From 025ebb7890b2f4805e254150df6c680779bf8c6b Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Mon, 27 Feb 2023 18:02:40 +0100 Subject: [PATCH] Cleaned up duplicate middleware refs https://github.com/TryGhost/Ghost/commit/621cfd98663d2f4a9ae824107bf338c92078578b - this file was meant to be moved to a folder in the referenced commit, but that never happened - this commit fixes that --- ghost/core/core/server/web/admin/middleware.js | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 ghost/core/core/server/web/admin/middleware.js diff --git a/ghost/core/core/server/web/admin/middleware.js b/ghost/core/core/server/web/admin/middleware.js deleted file mode 100644 index c0f7214075..0000000000 --- a/ghost/core/core/server/web/admin/middleware.js +++ /dev/null @@ -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 -];