From 86c28e382ea3f61996d68b209f850db22f2cd19d Mon Sep 17 00:00:00 2001 From: ololoken Date: Mon, 21 May 2018 17:26:32 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20/edit=20shortcut=20not?= =?UTF-8?q?=20working=20in=20Safari=20(#9637)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #9633 - use non-hash URL for admin redirects so that redirects are followed correctly by Safari when admin is on different domain --- core/server/controllers/entry.js | 2 +- core/server/controllers/preview.js | 2 +- core/test/functional/routes/frontend_spec.js | 4 ++-- core/test/unit/controllers/entry_spec.js | 2 +- core/test/unit/controllers/preview_spec.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/server/controllers/entry.js b/core/server/controllers/entry.js index 9923e70afc..352ea21b33 100644 --- a/core/server/controllers/entry.js +++ b/core/server/controllers/entry.js @@ -31,7 +31,7 @@ module.exports = function entryController(req, res, next) { // CASE: last param is of url is /edit, redirect to admin if (lookup.isEditURL) { - return urlService.utils.redirectToAdmin(302, res, '#/editor/' + post.id); + return urlService.utils.redirectToAdmin(302, res, '/editor/' + post.id); } // CASE: permalink is not valid anymore, we redirect him permanently to the correct one diff --git a/core/server/controllers/preview.js b/core/server/controllers/preview.js index e9695b6fdc..534332f770 100644 --- a/core/server/controllers/preview.js +++ b/core/server/controllers/preview.js @@ -30,7 +30,7 @@ module.exports = function previewController(req, res, next) { if (req.params.options && req.params.options.toLowerCase() === 'edit') { // CASE: last param is of url is /edit, redirect to admin - return urlService.utils.redirectToAdmin(302, res, '#/editor/' + post.id); + return urlService.utils.redirectToAdmin(302, res, '/editor/' + post.id); } else if (req.params.options) { // CASE: unknown options param detected. Ignore and end in 404. return next(); diff --git a/core/test/functional/routes/frontend_spec.js b/core/test/functional/routes/frontend_spec.js index 5054dcfdbb..5cb1192cfb 100644 --- a/core/test/functional/routes/frontend_spec.js +++ b/core/test/functional/routes/frontend_spec.js @@ -251,7 +251,7 @@ describe('Frontend Routing', function () { it('should redirect to editor', function (done) { request.get('/welcome/edit/') - .expect('Location', /ghost\/#\/editor\/\w+/) + .expect('Location', /ghost\/editor\/\w+/) .expect('Cache-Control', testUtils.cacheRules.public) .expect(302) .end(doEnd(done)); @@ -399,7 +399,7 @@ describe('Frontend Routing', function () { it('should redirect to editor', function (done) { request.get('/static-page-test/edit/') - .expect('Location', /ghost\/#\/editor\/\w+/) + .expect('Location', /ghost\/editor\/\w+/) .expect('Cache-Control', testUtils.cacheRules.public) .expect(302) .end(doEnd(done)); diff --git a/core/test/unit/controllers/entry_spec.js b/core/test/unit/controllers/entry_spec.js index a1efbbcfcc..5702050036 100644 --- a/core/test/unit/controllers/entry_spec.js +++ b/core/test/unit/controllers/entry_spec.js @@ -17,7 +17,7 @@ var should = require('should'), sandbox = sinon.sandbox.create(); describe('Controllers', function () { - var adminEditPagePath = '/ghost/#/editor/', + var adminEditPagePath = '/ghost/editor/', localSettingsCache = {}, hasTemplateStub; diff --git a/core/test/unit/controllers/preview_spec.js b/core/test/unit/controllers/preview_spec.js index 0c41b17eb5..6bf7385efd 100644 --- a/core/test/unit/controllers/preview_spec.js +++ b/core/test/unit/controllers/preview_spec.js @@ -178,7 +178,7 @@ describe('Controllers', function () { res.redirect = function (url) { res.render.called.should.be.false(); res.set.called.should.be.false(); - url.should.eql('/ghost/#/editor/1/'); + url.should.eql('/ghost/editor/1/'); done(); };