From dad664afe0bfd8288bc1bb070d802f6cc94f3a84 Mon Sep 17 00:00:00 2001 From: "Robbie Harwood (frozencemetery)" Date: Thu, 9 Apr 2015 11:44:51 -0400 Subject: [PATCH] Add irc and ircs URL support --- lib/html/pipeline/sanitization_filter.rb | 2 +- test/html/pipeline/sanitization_filter_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/html/pipeline/sanitization_filter.rb b/lib/html/pipeline/sanitization_filter.rb index 0d88a48b..fc83ef6c 100644 --- a/lib/html/pipeline/sanitization_filter.rb +++ b/lib/html/pipeline/sanitization_filter.rb @@ -37,7 +37,7 @@ class SanitizationFilter < Filter TABLE_SECTIONS = Set.new(%w(thead tbody tfoot).freeze) # These schemes are the only ones allowed in attributes by default. - ANCHOR_SCHEMES = ['http', 'https', 'mailto', :relative, 'github-windows', 'github-mac'].freeze + ANCHOR_SCHEMES = ['http', 'https', 'mailto', :relative, 'github-windows', 'github-mac', 'irc', 'ircs'].freeze # The main sanitization whitelist. Only these elements and attributes are # allowed through by default. diff --git a/test/html/pipeline/sanitization_filter_test.rb b/test/html/pipeline/sanitization_filter_test.rb index 7bdca56f..daeec76f 100644 --- a/test/html/pipeline/sanitization_filter_test.rb +++ b/test/html/pipeline/sanitization_filter_test.rb @@ -90,7 +90,7 @@ def test_uses_anchor_schemes_from_whitelist_when_not_separately_specified end def test_whitelist_contains_default_anchor_schemes - assert_equal SanitizationFilter::WHITELIST[:protocols]['a']['href'], ['http', 'https', 'mailto', :relative, 'github-windows', 'github-mac'] + assert_equal SanitizationFilter::WHITELIST[:protocols]['a']['href'], ['http', 'https', 'mailto', :relative, 'github-windows', 'github-mac', 'irc', 'ircs'] end def test_whitelist_from_full_constant @@ -101,7 +101,7 @@ def test_whitelist_from_full_constant end def test_exports_default_anchor_schemes - assert_equal SanitizationFilter::ANCHOR_SCHEMES, ['http', 'https', 'mailto', :relative, 'github-windows', 'github-mac'] + assert_equal SanitizationFilter::ANCHOR_SCHEMES, ['http', 'https', 'mailto', :relative, 'github-windows', 'github-mac', 'irc', 'ircs'] end def test_script_contents_are_removed