From 895299a4b37d0217ca020afe79d23252f9a1ab70 Mon Sep 17 00:00:00 2001 From: Felix Klein Date: Mon, 18 Apr 2022 03:40:19 +0200 Subject: [PATCH] modify vimeo parseHash to use non-named capture groups (#2426) --- src/js/plugins/vimeo.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js index f20159f9..81238105 100644 --- a/src/js/plugins/vimeo.js +++ b/src/js/plugins/vimeo.js @@ -35,12 +35,12 @@ function parseHash(url) { * - [https://player.]vimeo.com/video/{id}?h={hash}[¶ms] * - [https://player.]vimeo.com/video/{id}?[params]&h={hash} * - video/{id}/{hash} - * If matched, the hash is available in the named group `hash` + * If matched, the hash is available in capture group 4 */ - const regex = /^.*(?:vimeo.com\/|video\/)(?:\d+)(?:\?.*&*h=|\/)+(?[\d,a-f]+)/; + const regex = /^.*(vimeo.com\/|video\/)(\d+)(\?.*&*h=|\/)+([\d,a-f]+)/; const found = url.match(regex); - return found ? found.groups.hash : null; + return found && found.length === 5 ? found[4] : null; } // Set playback state and trigger change (only on actual change)