0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

🐛 Fixed redirect for pages causing 404

closes #10649

- `resourceType` in API v0.1 is only of 'post' type. Because in admin we now distinguish between 2 types of editable resources: 'posts' and 'page' the redirect has to be based on 'entry.page' flag
This commit is contained in:
Nazar Gargol 2019-04-22 15:08:09 +02:00
parent 1facbc5c02
commit 2253b2d18c

View file

@ -32,7 +32,9 @@ module.exports = function entryController(req, res, next) {
// CASE: last param is of url is /edit, redirect to admin
if (lookup.isEditURL) {
debug('redirect. is edit url');
return urlService.utils.redirectToAdmin(302, res, `/editor/${res.routerOptions.resourceType.replace(/s$/, '')}/${entry.id}`);
const resourceType = entry.page ? 'page' : 'post';
return urlService.utils.redirectToAdmin(302, res, `/editor/${resourceType}/${entry.id}`);
}
/**