Skip to content

Commit 8d1751e

Browse files
Merge pull request #590 from papermark/fix/files
2 parents f7cd3d7 + b54f614 commit 8d1751e

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

packages/react-notion-x/src/components/asset.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ export function Asset({
135135
}
136136

137137
if (block.space_id) {
138-
source = source.concat('&spaceId=', block.space_id)
138+
const url = new URL(source)
139+
url.searchParams.set('spaceId', block.space_id)
140+
source = url.toString()
139141
}
140142

141143
let content = null

packages/react-notion-x/src/components/audio.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ export function Audio({
1616
let source =
1717
recordMap.signed_urls[block.id] || block.properties?.source?.[0]?.[0]
1818

19-
if (block.space_id) {
20-
source = source?.concat('&spaceId=', block.space_id)
21-
}
22-
2319
if (!source) {
2420
return null
2521
}
2622

23+
if (block.space_id) {
24+
const url = new URL(source)
25+
url.searchParams.set('spaceId', block.space_id)
26+
source = url.toString()
27+
}
28+
2729
return (
2830
<div className={cs('notion-audio', className)}>
2931
<audio controls preload='none' src={source} />

packages/react-notion-x/src/components/file.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ export function File({
2323
}
2424

2525
if (block.space_id) {
26-
source = source.concat('&spaceId=', block.space_id)
26+
const url = new URL(source)
27+
url.searchParams.set('spaceId', block.space_id)
28+
source = url.toString()
2729
}
2830

2931
return (

0 commit comments

Comments
 (0)