From 28cb2f468d444a449de3216da672034d4033ea59 Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Tue, 15 Mar 2022 10:44:13 +0100 Subject: [PATCH] fix twitter bug --- src/components/controls/atoms/Media.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/controls/atoms/Media.js b/src/components/controls/atoms/Media.js index 55bb2a9..f127097 100644 --- a/src/components/controls/atoms/Media.js +++ b/src/components/controls/atoms/Media.js @@ -65,9 +65,12 @@ const Media = ({ src, title }) => { case "Tweet": const tweetIdRegex = - /https?:\/\/twitter.com\/[0-9a-zA-Z_]{1,20}\/status\/([0-9]*)/; + /https?:\/\/(mobile\.){0,1}twitter.com\/[0-9a-zA-Z_]{1,20}\/status\/([0-9]*)/; const match = tweetIdRegex.exec(src); - const tweetId = match[1]; + if (!match || match.length < 2) { + return null; + } + const tweetId = match[match.length - 1]; return (