Skip to content

Commit

Permalink
[BUGFIX] Use proper regexp for Vimeo URLs in online media helper
Browse files Browse the repository at this point in the history
The change for issue #94357 introduced handling for `event/` URLs,
and accidentally modified handling for `video/` URLs as well. As a
result, the `video/` IDs were incorrectly resolved containing a
leading slash.

Resolves: #96509
Releases: main, 11.5, 10.4
Change-Id: I5623ff59dac44a699877e4e5a2e91707f72a407e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72967
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
  • Loading branch information
ohader committed Jan 11, 2022
1 parent 48d5c96 commit 0e0524b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Expand Up @@ -73,7 +73,7 @@ public function transformUrlToFile($url, Folder $targetFolder)
// - vimeo.com/<code>/<optionalPrivateCode> # Share URL
// - vimeo.com/event/<code>
// - player.vimeo.com/video/<code>/<optionalPrivateCode> # URL form iframe embed code, can also get code from full iframe snippet
if (preg_match('/vimeo\.com\/(?:video|event\/)?([0-9a-z\/]+)/i', $url, $matches)) {
if (preg_match('/vimeo\.com\/(?:video\/|event\/)?([0-9a-z\/]+)/i', $url, $matches)) {
$videoId = $matches[1];
}
if (empty($videoId)) {
Expand Down
Expand Up @@ -80,6 +80,8 @@ public function transformUrlDataProvider(): array
['https://typo3.org/', null, null],
['https://vimeo.com/', '7215347324', $fileResourceMock],
['https://vimeo.com/', '7215347324/hasf8a65sdsa7d', $fileResourceMock],
['https://vimeo.com/video/', '7215347324', $fileResourceMock],
['https://vimeo.com/video/', '7215347324/hasf8a65sdsa7d', $fileResourceMock],
['https://player.vimeo.com/', '7215347324', $fileResourceMock],
['https://player.vimeo.com/', '7215347324/hasf8a65sdsa7d', $fileResourceMock],
['https://vimeo.com/event/', '7215347324', $fileResourceMock],
Expand Down

0 comments on commit 0e0524b

Please sign in to comment.