0
Fork 0
mirror of https://github.com/penpot/penpot-export.git synced 2025-01-19 21:22:28 -05:00

fix(cli): parse URL with extra search params

This commit is contained in:
Roberto Redradix 2023-09-26 17:42:46 +02:00
parent 59dcbfef60
commit f197a8075d
2 changed files with 15 additions and 1 deletions

View file

@ -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', () => {

View file

@ -14,7 +14,7 @@ export function parsePenpotUrl(url: string) {
}
const [workspaceId, fileId, pageId] = parsedUrl.hash
.split(/[\/?=]/)
.split(/[\/?=&]/)
.filter((match) => UUID_RE.test(match))
return {