mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-05 18:34:39 +03:00
Uncapitalise middleware should not affect tokens
no issue - Whilst testing on next, I noticed trying to signup didn't prepopulate email addresses any more, and this is why
This commit is contained in:
parent
3fec767df7
commit
25ad4b39fd
@ -154,9 +154,16 @@ function redirectToSetup(req, res, next) {
|
||||
|
||||
// Detect uppercase in req.path
|
||||
function uncapitalise(req, res, next) {
|
||||
if (/[A-Z]/.test(req.path)) {
|
||||
var pathToTest = req.path,
|
||||
isSignupOrReset = req.path.match(/(\/ghost\/(signup|reset)\/)/i);
|
||||
|
||||
if (isSignupOrReset) {
|
||||
pathToTest = isSignupOrReset[1];
|
||||
}
|
||||
|
||||
if (/[A-Z]/.test(pathToTest)) {
|
||||
res.set('Cache-Control', 'public, max-age=' + utils.ONE_YEAR_S);
|
||||
res.redirect(301, req.url.replace(req.path, req.path.toLowerCase()));
|
||||
res.redirect(301, req.url.replace(pathToTest, pathToTest.toLowerCase()));
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user