mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
🐛 Fixed trailing slashes not handled in Settings (#19640)
fixes https://linear.app/tryghost/issue/ENG-609/staff-users-can-no-longer-be-opened-directly-with-their-url - additionally added an `edit` route for editing staff users, which fixes a regression.
This commit is contained in:
parent
c12e279e0c
commit
a47d55d1a2
2 changed files with 2 additions and 2 deletions
|
@ -46,7 +46,6 @@ function getHashPath(basePath: string, urlPath: string | undefined) {
|
||||||
}
|
}
|
||||||
const regex = new RegExp(`/${basePath}/(.*)`);
|
const regex = new RegExp(`/${basePath}/(.*)`);
|
||||||
const match = urlPath?.match(regex);
|
const match = urlPath?.match(regex);
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
const afterSettingsX = match[1];
|
const afterSettingsX = match[1];
|
||||||
return afterSettingsX;
|
return afterSettingsX;
|
||||||
|
@ -84,7 +83,7 @@ const handleNavigation = (basePath: string, currentRoute: string | undefined, lo
|
||||||
};
|
};
|
||||||
|
|
||||||
const matchRoute = (pathname: string, routeDefinition: string) => {
|
const matchRoute = (pathname: string, routeDefinition: string) => {
|
||||||
const regex = new RegExp('^' + routeDefinition.replace(/:(\w+)/, '(?<$1>[^/]+)') + '$');
|
const regex = new RegExp('^' + routeDefinition.replace(/:(\w+)/g, '(?<$1>[^/]+)') + '/?$');
|
||||||
const match = pathname.match(regex);
|
const match = pathname.match(regex);
|
||||||
if (match) {
|
if (match) {
|
||||||
return match.groups || {};
|
return match.groups || {};
|
||||||
|
|
|
@ -11,6 +11,7 @@ export const modalPaths: {[key: string]: ModalName} = {
|
||||||
'navigation/edit': 'NavigationModal',
|
'navigation/edit': 'NavigationModal',
|
||||||
'staff/invite': 'InviteUserModal',
|
'staff/invite': 'InviteUserModal',
|
||||||
'staff/:slug': 'UserDetailModal',
|
'staff/:slug': 'UserDetailModal',
|
||||||
|
'staff/:slug/edit': 'UserDetailModal',
|
||||||
'portal/edit': 'PortalModal',
|
'portal/edit': 'PortalModal',
|
||||||
'tiers/add': 'TierDetailModal',
|
'tiers/add': 'TierDetailModal',
|
||||||
'tiers/:id': 'TierDetailModal',
|
'tiers/:id': 'TierDetailModal',
|
||||||
|
|
Loading…
Add table
Reference in a new issue