diff --git a/packages/cli/src/penpot/urls.test.ts b/packages/cli/src/penpot/urls.test.ts index 2b2f1d9..3ff693b 100644 --- a/packages/cli/src/penpot/urls.test.ts +++ b/packages/cli/src/penpot/urls.test.ts @@ -80,6 +80,20 @@ describe('Penpot URL parser', () => { assert.deepStrictEqual(parsePenpotUrl(input), expect) }) + + it('parses it with page id and extra parameters', () => { + const input = + 'https://design.penpot.app/#/workspace/da58b520-6ba3-11eb-9ba1-03f8ac143bbf/187ee84f-c56d-8067-8002-5f0222d9c181?page-id=187ee84f-c56d-8067-8002-5f0223a68847&layout=assets' + + const expect = { + instance: 'https://design.penpot.app/', + workspaceId: 'da58b520-6ba3-11eb-9ba1-03f8ac143bbf', + fileId: '187ee84f-c56d-8067-8002-5f0222d9c181', + pageId: '187ee84f-c56d-8067-8002-5f0223a68847', + } + + assert.deepStrictEqual(parsePenpotUrl(input), expect) + }) }) describe('when provided a self-hosted Penpot URL', () => { diff --git a/packages/cli/src/penpot/urls.ts b/packages/cli/src/penpot/urls.ts index c748e5d..4056642 100644 --- a/packages/cli/src/penpot/urls.ts +++ b/packages/cli/src/penpot/urls.ts @@ -14,7 +14,7 @@ export function parsePenpotUrl(url: string) { } const [workspaceId, fileId, pageId] = parsedUrl.hash - .split(/[\/?=]/) + .split(/[\/?=&]/) .filter((match) => UUID_RE.test(match)) return {