diff --git a/typo3/sysext/core/Classes/Resource/Rendering/VimeoRenderer.php b/typo3/sysext/core/Classes/Resource/Rendering/VimeoRenderer.php index ca6bc9f8a995b462568f825f34d2ae2f848dc20a..d893fd2355d89aad2c04076e571c138711a728b8 100644 --- a/typo3/sysext/core/Classes/Resource/Rendering/VimeoRenderer.php +++ b/typo3/sysext/core/Classes/Resource/Rendering/VimeoRenderer.php @@ -148,7 +148,7 @@ class VimeoRenderer implements FileRendererInterface if (isset($options['api']) && (int)$options['api'] === 1) { $urlParams[] = 'api=1'; } - if (!empty($options['no-cookie'])) { + if (!isset($options['no-cookie']) || !empty($options['no-cookie'])) { $urlParams[] = 'dnt=1'; } $urlParams[] = 'title=' . (int)!empty($options['showinfo']); diff --git a/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php b/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php index 44f47df458db2d88c6ee22a99aa39c07eaaa9c9e..707ce11b636fb792b020c1f11d46c2d8e2e55bdc 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/Rendering/VimeoRendererTest.php @@ -91,7 +91,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', $this->subject->render($fileResourceMock, '300m', '200') ); } @@ -104,7 +104,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?loop=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?loop=1&dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', $this->subject->render($fileResourceMock, '300m', '200', ['loop' => 1]) ); } @@ -117,7 +117,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?autoplay=1&muted=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="autoplay; fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?autoplay=1&muted=1&dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="autoplay; fullscreen"></iframe>', $this->subject->render($fileResourceMock, '300m', '200', ['autoplay' => 1]) ); } @@ -134,7 +134,7 @@ class VimeoRendererTest extends UnitTestCase $fileReferenceMock->method('getOriginalFile')->willReturn($fileResourceMock); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?autoplay=1&muted=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="autoplay; fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?autoplay=1&muted=1&dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="autoplay; fullscreen"></iframe>', $this->subject->render($fileReferenceMock, '300m', '200') ); } @@ -147,7 +147,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?autoplay=1&muted=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="autoplay; fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?autoplay=1&muted=1&dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="autoplay; fullscreen"></iframe>', $this->subject->render($fileResourceMock, '300m', '200', ['autoplay' => 1]) ); } @@ -160,7 +160,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?title=0&byline=0&portrait=0" allowfullscreen foo="bar" custom-play="preload" sanitizetest="<>"'test" width="300" height="200" allow="fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?dnt=1&title=0&byline=0&portrait=0" allowfullscreen foo="bar" custom-play="preload" sanitizetest="<>"'test" width="300" height="200" allow="fullscreen"></iframe>', $this->subject->render($fileResourceMock, '300m', '200', ['additionalAttributes' => ['foo' => 'bar', 'custom-play' => 'preload', '<"\'>sanitize^&test' => '<>"\'test']]) ); } @@ -173,7 +173,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?title=0&byline=0&portrait=0" allowfullscreen data-player-handler="vimeo" data-custom-playerId="player-123" data-sanitizetest="test" width="300" height="200" allow="fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?dnt=1&title=0&byline=0&portrait=0" allowfullscreen data-player-handler="vimeo" data-custom-playerId="player-123" data-sanitizetest="test" width="300" height="200" allow="fullscreen"></iframe>', $this->subject->render($fileResourceMock, '300m', '200', ['data' => ['player-handler' => 'vimeo', 'custom-playerId' => 'player-123', '*sanitize&test"' => 'test']]) ); } @@ -186,7 +186,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?title=0&byline=0&portrait=0" allowfullscreen foo="bar" custom-play="preload" data-player-handler="vimeo" data-custom-playerId="player-123" width="300" height="200" allow="fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?dnt=1&title=0&byline=0&portrait=0" allowfullscreen foo="bar" custom-play="preload" data-player-handler="vimeo" data-custom-playerId="player-123" width="300" height="200" allow="fullscreen"></iframe>', $this->subject->render($fileResourceMock, '300m', '200', ['data' => ['player-handler' => 'vimeo', 'custom-playerId' => 'player-123'], 'additionalAttributes' => ['foo' => 'bar', 'custom-play' => 'preload']]) ); } @@ -199,7 +199,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="foo; bar"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="foo; bar"></iframe>', $this->subject->render($fileResourceMock, '300m', '200', ['allow' => 'foo; bar']) ); } @@ -212,7 +212,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?autoplay=1&muted=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="foo; bar"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?autoplay=1&muted=1&dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="foo; bar"></iframe>', $this->subject->render($fileResourceMock, '300m', '200', ['allow' => 'foo; bar', 'autoplay' => 1]) ); } @@ -231,7 +231,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331/private0123?title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331/private0123?dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', $subject->render($fileResourceMock, '300m', '200') ); } @@ -250,7 +250,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331<script>danger</script>'"random"quotes;?title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331<script>danger</script>'"random"quotes;?dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', $subject->render($fileResourceMock, '300m', '200') ); } @@ -263,7 +263,7 @@ class VimeoRendererTest extends UnitTestCase $fileResourceMock = $this->createMock(File::class); self::assertSame( - '<iframe src="https://player.vimeo.com/video/7331?api=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', + '<iframe src="https://player.vimeo.com/video/7331?api=1&dnt=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', $this->subject->render($fileResourceMock, '300m', '200', ['api' => 1]) ); } @@ -271,7 +271,7 @@ class VimeoRendererTest extends UnitTestCase /** * @test */ - public function renderOutputWithDisabledNoCookieIsCorrect(): void + public function renderOutputWithEnabledNoCookieIsCorrect(): void { $fileResourceMock = $this->createMock(File::class); @@ -280,4 +280,17 @@ class VimeoRendererTest extends UnitTestCase $this->subject->render($fileResourceMock, '300m', '200', ['api' => 1, 'no-cookie' => 1]) ); } + + /** + * @test + */ + public function renderOutputWithDisabledNoCookieIsCorrect(): void + { + $fileResourceMock = $this->createMock(File::class); + + self::assertSame( + '<iframe src="https://player.vimeo.com/video/7331?api=1&title=0&byline=0&portrait=0" allowfullscreen width="300" height="200" allow="fullscreen"></iframe>', + $this->subject->render($fileResourceMock, '300m', '200', ['api' => 1, 'no-cookie' => 0]) + ); + } }