mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
parse_cf_email.rb: fix URI.unescape is obsolete
This commit is contained in:
parent
f5eb47fadf
commit
fbfa9de39c
2 changed files with 18 additions and 1 deletions
|
@ -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
|
||||
|
|
17
test/lib/docs/filters/core/parse_cf_email_test.rb
Normal file
17
test/lib/docs/filters/core/parse_cf_email_test.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue