Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.8] only block registration when appRoute contains the exact basePath (#67125) #68089

Merged
merged 1 commit into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/core/public/application/application_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ describe('#setup()', () => {
).toThrowErrorMatchingInlineSnapshot(
`"Cannot register an application route that includes HTTP base path"`
);

expect(() =>
register(Symbol(), createApp({ id: 'app3', appRoute: '/base-path-i-am-not' }))
).not.toThrow();
});
});

Expand Down
4 changes: 2 additions & 2 deletions src/core/public/application/application_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class ApplicationService {
throw new Error(
`An application is already registered with the appRoute "${app.appRoute}"`
);
} else if (basename && app.appRoute!.startsWith(basename)) {
} else if (basename && app.appRoute!.startsWith(`${basename}/`)) {
throw new Error('Cannot register an application route that includes HTTP base path');
}

Expand Down Expand Up @@ -208,7 +208,7 @@ export class ApplicationService {
throw new Error('Applications cannot be registered after "setup"');
} else if (this.apps.has(app.id)) {
throw new Error(`An application is already registered with the id "${app.id}"`);
} else if (basename && appRoute!.startsWith(basename)) {
} else if (basename && appRoute!.startsWith(`${basename}/`)) {
throw new Error('Cannot register an application route that includes HTTP base path');
}

Expand Down