mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
🐛 Fixed redirect issue with private sites (#9960)
closes #9959 This issue existed because the logic assumed that if there were no query parameters then there would be no `query` object. However this is not the case. What we really wanted to check was for the existence of an "r" query param - the code has been refactor to explicitly do this now.
This commit is contained in:
parent
d699daeb35
commit
e392fe55ae
2 changed files with 4 additions and 2 deletions
|
@ -22,7 +22,7 @@ function verifySessionHash(salt, hash) {
|
|||
}
|
||||
|
||||
function getRedirectUrl(query) {
|
||||
const redirect = decodeURIComponent(query ? query.r : '/');
|
||||
const redirect = decodeURIComponent(query.r || '/');
|
||||
try {
|
||||
return new url.URL(redirect, urlService.utils.urlFor('home', true)).pathname;
|
||||
} catch (e) {
|
||||
|
|
|
@ -25,7 +25,9 @@ describe('Private Blogging', function () {
|
|||
var req, res, next;
|
||||
|
||||
beforeEach(function () {
|
||||
req = {};
|
||||
req = {
|
||||
query: {}
|
||||
};
|
||||
res = {};
|
||||
settingsStub = sandbox.stub(settingsCache, 'get');
|
||||
next = sandbox.spy();
|
||||
|
|
Loading…
Add table
Reference in a new issue