Skip to content

Commit 7d85844

Browse files
committed
sanitise video url
1 parent a2a21da commit 7d85844

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dotcom-rendering/src/components/VideoAtom.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { ArticleFormat } from '../lib/articleFormat';
2+
import { sanitiseHTML } from '../model/sanitise';
23
import { Caption } from './Caption';
34
import { MaintainAspectRatio } from './MaintainAspectRatio';
45

@@ -27,6 +28,7 @@ export const VideoAtom = ({
2728
width = 460,
2829
}: Props) => {
2930
if (assets.length === 0) return null; // Handle empty assets array
31+
const santisedUrl = sanitiseHTML(assets[0]?.url ?? '');
3032
return (
3133
<>
3234
<MaintainAspectRatio
@@ -45,13 +47,13 @@ export const VideoAtom = ({
4547
{assets.map((asset, index) => (
4648
<source
4749
key={index}
48-
src={asset.url}
50+
src={santisedUrl}
4951
type={asset.mimeType}
5052
/>
5153
))}
5254
<p>
5355
{`Your browser doesn't support HTML5 video. Here is a `}
54-
<a href={assets[0]?.url}>link to the video</a> instead.
56+
<a href={santisedUrl}>link to the video</a> instead.
5557
</p>
5658
</video>
5759
</MaintainAspectRatio>

0 commit comments

Comments
 (0)