From c13b1df71dff792ef7059d3b4303596d4daa7c9a Mon Sep 17 00:00:00 2001 From: Eyal Gruss Date: Sat, 5 Oct 2024 16:27:26 +0300 Subject: [PATCH] trim input whitespace --- utils/videoloader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/videoloader.js b/utils/videoloader.js index 754b14f..d125531 100644 --- a/utils/videoloader.js +++ b/utils/videoloader.js @@ -1,5 +1,5 @@ export default function load_video(input, video_elem) { - input = input.value ?? input + input = (input.value ?? input).trim() let [vid_id, params, hash_params] = [...input.split(/(?:[?&]|(?=#))([^#]*)/), '', ''] if (vid_id.includes('=')) { if (params) @@ -51,7 +51,7 @@ export default function load_video(input, video_elem) { } else if (host && !host.includes('youtu')) { // Any non YouTube / Vimeo URL url = input - hash = input.match(/(.*?https:\/\/)?(.*)/).at(-1) + hash = input.match(/(https:\/\/)?(.*)/).at(-1) } else if (input) { // YouTube let playlist_params = '&playlist=' + vid_id if (params.size) {