From 2bd98407d23d96dc4df1be62b476067496d8e4f9 Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Tue, 21 Jun 2022 12:17:03 +0200 Subject: [PATCH] [bugfix,site][s]: YOUTUBE_REGEX was matching other urls so fixed by just using YOUTUBE_ID_REGEX - fixes #186. NB: probably can replace YOUTUBE_REGEX everywhere. --- site/components/Paragraph.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/components/Paragraph.js b/site/components/Paragraph.js index 746af8c..6c2d7b2 100644 --- a/site/components/Paragraph.js +++ b/site/components/Paragraph.js @@ -1,6 +1,6 @@ import LiteYouTubeEmbed from "react-lite-youtube-embed"; import TwitterEmbed from "./TwitterEmbed"; -import { YOUTUBE_REGEX, TWITTER_REGEX, YOUTUBE_ID_REGEX } from "../lib/constants"; +import { TWITTER_REGEX, YOUTUBE_ID_REGEX } from "../lib/constants"; export const Paragraph = (props) => { if ( @@ -10,7 +10,7 @@ export const Paragraph = (props) => { ) { const href = props.children.props.href - if (YOUTUBE_REGEX.test(href)) { + if (YOUTUBE_ID_REGEX.test(href)) { const youtubeId = href.match(YOUTUBE_ID_REGEX)[1]; let startTime = href.match(/t=[0-9]*/) if (startTime) startTime = startTime[0].split("=").pop()