[devdocsgjs/main: 1291/1867] parse_cf_email.rb: fix URI.unescape is obsolete
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 1291/1867] parse_cf_email.rb: fix URI.unescape is obsolete
- Date: Fri, 19 Nov 2021 23:47:52 +0000 (UTC)
commit fbfa9de39c8795dc4065c3936766a69836cd6128
Author: Simon Legner <Simon Legner gmail com>
Date: Tue Nov 24 23:02:25 2020 +0100
parse_cf_email.rb: fix URI.unescape is obsolete
lib/docs/filters/core/parse_cf_email.rb | 2 +-
test/lib/docs/filters/core/parse_cf_email_test.rb | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/lib/docs/filters/core/parse_cf_email.rb b/lib/docs/filters/core/parse_cf_email.rb
index 628b1429..75bedc5b 100644
--- a/lib/docs/filters/core/parse_cf_email.rb
+++ b/lib/docs/filters/core/parse_cf_email.rb
@@ -12,7 +12,7 @@ module Docs
result += "%" + "0#{("0x#{slice.join}".hex ^ mask).to_s(16)}"[-2..-1]
end
- node.replace(URI.decode(result))
+ node.replace(URI.decode_www_form_component(result))
end
doc
diff --git a/test/lib/docs/filters/core/parse_cf_email_test.rb
b/test/lib/docs/filters/core/parse_cf_email_test.rb
new file mode 100644
index 00000000..ed0a9229
--- /dev/null
+++ b/test/lib/docs/filters/core/parse_cf_email_test.rb
@@ -0,0 +1,17 @@
+require 'test_helper'
+require 'docs'
+
+class ParseCfEmailFilterTest < MiniTest::Spec
+ include FilterTestHelper
+ self.filter_class = Docs::ParseCfEmailFilter
+
+ before do
+ context[:url] = 'http://example.com/dir/file'
+ end
+
+ it 'rewrites parses CloudFlare mail addresses' do
+ href = 'b3dddad0d6d2ddd7c0dadec3dfd6f3d6cbd2dec3dfd69dd0dcde'
+ @body = %(<a class="__cf_email__" data-cfemail="#{href}">Link</a>)
+ assert_equal 'niceandsimple example com', filter_output_string
+ end
+end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]