Skip to content

Commit fbfa9de

Browse files
committed
parse_cf_email.rb: fix URI.unescape is obsolete
1 parent f5eb47f commit fbfa9de

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/docs/filters/core/parse_cf_email.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def call
1212
result += "%" + "0#{("0x#{slice.join}".hex ^ mask).to_s(16)}"[-2..-1]
1313
end
1414

15-
node.replace(URI.decode(result))
15+
node.replace(URI.decode_www_form_component(result))
1616
end
1717

1818
doc
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'test_helper'
2+
require 'docs'
3+
4+
class ParseCfEmailFilterTest < MiniTest::Spec
5+
include FilterTestHelper
6+
self.filter_class = Docs::ParseCfEmailFilter
7+
8+
before do
9+
context[:url] = 'http://example.com/dir/file'
10+
end
11+
12+
it 'rewrites parses CloudFlare mail addresses' do
13+
href = 'b3dddad0d6d2ddd7c0dadec3dfd6f3d6cbd2dec3dfd69dd0dcde'
14+
@body = %(<a class="__cf_email__" data-cfemail="#{href}">Link</a>)
15+
assert_equal '[email protected]', filter_output_string
16+
end
17+
end

0 commit comments

Comments
 (0)