mirror of
https://github.com/penpot/penpot-export.git
synced 2025-01-31 19:28:53 -05:00
fix(cli): parse URL with extra search params
This commit is contained in:
parent
59dcbfef60
commit
f197a8075d
2 changed files with 15 additions and 1 deletions
|
@ -80,6 +80,20 @@ describe('Penpot URL parser', () => {
|
||||||
|
|
||||||
assert.deepStrictEqual(parsePenpotUrl(input), expect)
|
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', () => {
|
describe('when provided a self-hosted Penpot URL', () => {
|
||||||
|
|
|
@ -14,7 +14,7 @@ export function parsePenpotUrl(url: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const [workspaceId, fileId, pageId] = parsedUrl.hash
|
const [workspaceId, fileId, pageId] = parsedUrl.hash
|
||||||
.split(/[\/?=]/)
|
.split(/[\/?=&]/)
|
||||||
.filter((match) => UUID_RE.test(match))
|
.filter((match) => UUID_RE.test(match))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Reference in a new issue