diff --git a/assets/chat/js/hashlinkconverter.js b/assets/chat/js/hashlinkconverter.js index e72d293c..74cc604b 100644 --- a/assets/chat/js/hashlinkconverter.js +++ b/assets/chat/js/hashlinkconverter.js @@ -7,8 +7,8 @@ const MISSING_VIDEO_ID_ERROR = 'Invalid Youtube link - Missing video id'; class HashLinkConverter { constructor() { this.hasHttp = /^http[s]?:\/{0,2}/; - this.youtubeLiveRegex = /^live\/([a-zA-z0-9_]{11})$/; - this.twitchClipRegex = /^[^/]+\/clip\/([a-zA-z0-9-]*)$/; + this.youtubeLiveRegex = /^live\/([A-Za-z0-9-_]{11})$/; + this.twitchClipRegex = /^[^/]+\/clip\/([A-Za-z0-9-_]*)$/; this.twitchVODRegex = /^videos\/(\d+)$/; this.rumbleEmbedRegex = /^embed\/([a-z0-9]+)\/?$/; } diff --git a/assets/chat/js/hashlinkconverter.test.js b/assets/chat/js/hashlinkconverter.test.js index 6a56c241..598f5199 100644 --- a/assets/chat/js/hashlinkconverter.test.js +++ b/assets/chat/js/hashlinkconverter.test.js @@ -39,6 +39,11 @@ describe('Valid embeds', () => { 'https://www.youtube.com/live/jfKfPfyJRdk?feature=share', '#youtube/jfKfPfyJRdk', ], + [ + 'Youtube live stream shareable link - and _', + 'https://www.youtube.com/live/EHs-_2ddcUQ?feature=share', + '#youtube/EHs-_2ddcUQ', + ], [ 'Rumble embed', 'https://rumble.com/embed/v26pcdc/?pub=4',