diff --git a/packages/react-notion-x/src/components/asset.tsx b/packages/react-notion-x/src/components/asset.tsx index 86827e3e8..17acf812e 100644 --- a/packages/react-notion-x/src/components/asset.tsx +++ b/packages/react-notion-x/src/components/asset.tsx @@ -135,7 +135,9 @@ export function Asset({ } if (block.space_id) { - source = source.concat('&spaceId=', block.space_id) + const url = new URL(source) + url.searchParams.set('spaceId', block.space_id) + source = url.toString() } let content = null diff --git a/packages/react-notion-x/src/components/audio.tsx b/packages/react-notion-x/src/components/audio.tsx index 6babeac04..88b2ec206 100644 --- a/packages/react-notion-x/src/components/audio.tsx +++ b/packages/react-notion-x/src/components/audio.tsx @@ -16,14 +16,16 @@ export function Audio({ let source = recordMap.signed_urls[block.id] || block.properties?.source?.[0]?.[0] - if (block.space_id) { - source = source?.concat('&spaceId=', block.space_id) - } - if (!source) { return null } + if (block.space_id) { + const url = new URL(source) + url.searchParams.set('spaceId', block.space_id) + source = url.toString() + } + return (