0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

🐛 Fixed /edit shortcut not working in Safari (#9637)

closes #9633 
- use non-hash URL for admin redirects so that redirects are followed correctly by Safari when admin is on different domain
This commit is contained in:
ololoken 2018-05-21 17:26:32 +03:00 committed by Kevin Ansfield
parent 2cc032524e
commit 86c28e382e
5 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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();

View file

@ -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));

View file

@ -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;

View file

@ -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();
};