diff --git a/core/includes/common.inc b/core/includes/common.inc index 9fa2638..d5e9c90 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -1299,7 +1299,7 @@ function drupal_strip_dangerous_protocols($uri) { // During test-setup system.filter.protocols may be empty. In order to // avoid test breakage, a list of protocols necessary to run tests is // supplied in that case. - $allowed_protocols = array_flip(config('system.filter')->get('protocols') ?: array('http', 'https')); + $allowed_protocols = array_flip(config('system.filter')->get('protocols') ?: array('ftp', 'http', 'https', 'irc', 'mailto', 'news', 'nntp', 'rtsp', 'sftp', 'ssh', 'tel', 'telnet', 'webcal')); } // Iteratively remove any invalid protocol found. diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 01948b0..c17971c 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -1552,7 +1552,7 @@ function _filter_url($text, $filter) { // we cannot cleanly differ between protocols here without hard-coding MAILTO, // so '//' is optional for all protocols. // @see filter_xss_bad_protocol() - $protocols = config('system.filter')->get('protocols'); + $protocols = config('system.filter')->get('protocols') ?: array('ftp', 'http', 'https', 'irc', 'mailto', 'news', 'nntp', 'rtsp', 'sftp', 'ssh', 'tel', 'telnet', 'webcal'); $protocols = implode(':(?://)?|', $protocols) . ':(?://)?'; // Prepare domain name pattern. diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php index 27971e5..e6e0999 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php @@ -22,13 +22,6 @@ public static function getInfo() { ); } - public function setUp() { - parent::setUp(); - // Manually set the allowed protocols. The list should be kept in sync with - // core/modules/system/config/system.filter.yml. - config('system.filter')->set('protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal', 'rtsp'))->save(); - } - /** * Tests the line break filter. */ @@ -485,8 +478,8 @@ function testUrlFilter() { 'me@me.tv' => TRUE, ), // Absolute URL protocols. - // The list to test is found in the file - // core/modules/system/config/system.filter.yml. + // The list to test is found in the beginning of _filter_url() at + // $protocols = config('system.filter')->get('protocols')... (approx line 1555). ' https://example.com, ftp://ftp.example.com, diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 1539e50..58e3259 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -2217,7 +2217,7 @@ function system_update_8034() { * * @ingroup config_upgrade */ -function system_update_8034() { +function system_update_8035() { update_variables_to_config('system.filter', array( 'filter_allowed_protocols' => 'protocols', ));