From 9d5dbbbd2f8263a13bd232852ac5637a9501b6f5 Mon Sep 17 00:00:00 2001 From: Brandon Kelly Date: Mon, 19 Oct 2020 06:52:03 -0700 Subject: [PATCH] Fixed #278 --- CHANGELOG.md | 5 +++++ src/Field.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9230599..6276f56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Release Notes for Redactor for Craft CMS +## Unreleased + +### Fixed +- Fixed a bug where protocol-relative YouTube and Vimeo video URLs were getting stripped by HTML Purifier. ([#278](https://github.com/craftcms/redactor/issues/278)) + ## 2.8.2 - 2020-10-14 ### Added diff --git a/src/Field.php b/src/Field.php index d6eea76..74ae172 100644 --- a/src/Field.php +++ b/src/Field.php @@ -1017,7 +1017,7 @@ private function _getPurifierConfig(): HTMLPurifier_Config 'Attr.EnableID' => true, 'HTML.AllowedComments' => ['pagebreak'], 'HTML.SafeIframe' => true, - 'URI.SafeIframeRegexp' => '%^https?://(www.youtube.com/embed/|player.vimeo.com/video/)%', + 'URI.SafeIframeRegexp' => '%^(https?:)?//(www.youtube.com/embed/|player.vimeo.com/video/)%', ]; foreach ($config as $option => $value) {