From 0a85ea4c9de7aabc057b793addbc651216b7de37 Mon Sep 17 00:00:00 2001 From: Jeremy Amos Date: Thu, 20 Jul 2023 12:03:19 -0700 Subject: [PATCH] fix for parsing when no hash is present --- src/Services/Vimeo.php | 2 +- tests/Rules/EmbeddableUrlTest.php | 2 ++ tests/Services/VimeoTest.php | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Services/Vimeo.php b/src/Services/Vimeo.php index 59e5fc2..03e162a 100644 --- a/src/Services/Vimeo.php +++ b/src/Services/Vimeo.php @@ -22,7 +22,7 @@ protected function viewData(): array */ protected function parseUrl(): ?array { - preg_match('/(https?:\/\/)?(www\.)?(player\.)?vimeo\.com\/([a-z]*\/)*([0-9]{6,11})\/([a-z0-9]+)[?]?.*/', $this->url, $match); + preg_match('/(https?:\/\/)?(www\.)?(player\.)?vimeo\.com\/([a-z]*\/)*([0-9]{6,11})\/?([a-z0-9]+)[?]?.*/', $this->url, $match); if (array_key_exists(5, $match)) { return [ diff --git a/tests/Rules/EmbeddableUrlTest.php b/tests/Rules/EmbeddableUrlTest.php index 953f95a..27843d9 100644 --- a/tests/Rules/EmbeddableUrlTest.php +++ b/tests/Rules/EmbeddableUrlTest.php @@ -19,6 +19,8 @@ public function test_it_passes_a_validUrl_for_any_service() 'https://miro.com/miroverse/category/workshops/remote-ux-workshops', 'http://www.slideshare.net/haraldf/business-quotes-for-2011', 'https://vimeo.com/148751763', + 'https://vimeo.com/148751763/243529c0ef', + 'https://vimeo.com/148751763/243529c0ef?share=copy', 'https://youtu.be/dQw4w9WgXcQ', 'https://www.youtube.com/embed/dQw4w9WgXcQ', ]; diff --git a/tests/Services/VimeoTest.php b/tests/Services/VimeoTest.php index 36544a1..08d164a 100644 --- a/tests/Services/VimeoTest.php +++ b/tests/Services/VimeoTest.php @@ -28,6 +28,8 @@ protected function validUrls(): array { return [ 'https://vimeo.com/148751763', + 'https://vimeo.com/148751763/243529c0ef', + 'https://vimeo.com/148751763/243529c0ef?share=copy', ]; } }