summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2024-05-16 14:46:46 -0400
committerGitHub <noreply@github.com>2024-05-16 12:46:46 -0600
commitf1da34a14442e49747a81a40a40815856c9f894e (patch)
treee23a90bdd5623d5c571380ad40468d837685027d /lib
parentd3ded5a0d5b39556d5a0d04a8c9af0acecb8f759 (diff)
resolves #4576 encode spaces in mailto links as %20, in accordance with RFC 3986, instead of using + (PR #4591)
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/helpers.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/asciidoctor/helpers.rb b/lib/asciidoctor/helpers.rb
index fc5a37f0..e92aa978 100644
--- a/lib/asciidoctor/helpers.rb
+++ b/lib/asciidoctor/helpers.rb
@@ -146,10 +146,13 @@ module Helpers
})
)
end
+ elsif (CGI = ::CGI).respond_to? :escapeURIComponent
+ def encode_uri_component str
+ CGI.escapeURIComponent str
+ end
else
- CGI = ::CGI
def encode_uri_component str
- CGI.escape str
+ (CGI.escape str).gsub '+', '%20'
end
end