Skip to content

Commit

Permalink
Fixed notion import button url (#2932)
Browse files Browse the repository at this point in the history
  • Loading branch information
Devorein authored Oct 13, 2023
1 parent d151834 commit a19f3f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/utilities/__tests__/browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ describe('getNewUrl()', () => {
});

describe('getSubdomainPath()', () => {
it('should not modify the path that starts with /api', () => {
const result = getSubdomainPath('/api', { domain: 'charmverse' });
expect(result).toEqual('/api');
});

it('should not return the path with subdomain when on subdomain host', () => {
const result = getSubdomainPath('/foo', { domain: 'charmverse' }, 'charmverse.charmverse.io');
expect(result).toEqual('/foo');
Expand Down
4 changes: 4 additions & 0 deletions lib/utilities/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ export function getSubdomainPath(
config?: { domain: string; customDomain?: string | null },
host?: string
) {
if (path.startsWith('/api')) {
return path;
}

const subdomain = getSpaceDomainFromHost(host);
const customDomain = getCustomDomainFromHost(host);
// strip out domain when using full custom domain
Expand Down

0 comments on commit a19f3f9

Please sign in to comment.