diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-02 18:06:20 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-02 18:06:20 +0000 |
commit | de2ae3154f4ba1c23eeaa4ace41177ecd9b6005a (patch) | |
tree | e4b82deecd51d637533b507dc8a21b410069c093 /lib | |
parent | 4f4dcd3c5d7a15b7eab5fa28e27482fa68c750a3 (diff) | |
download | gitlab-ce-de2ae3154f4ba1c23eeaa4ace41177ecd9b6005a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/filter/table_of_contents_filter.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/banzai/filter/table_of_contents_filter.rb b/lib/banzai/filter/table_of_contents_filter.rb index ade4d260be1..a2c8e92e560 100644 --- a/lib/banzai/filter/table_of_contents_filter.rb +++ b/lib/banzai/filter/table_of_contents_filter.rb @@ -56,7 +56,8 @@ module Banzai private def anchor_tag(href) - %Q{<a id="user-content-#{href}" class="anchor" href="##{href}" aria-hidden="true"></a>} + escaped_href = CGI.escape(href) # account for non-ASCII characters + %Q{<a id="user-content-#{href}" class="anchor" href="##{escaped_href}" aria-hidden="true"></a>} end def push_toc(children, root: false) @@ -80,7 +81,7 @@ module Banzai def initialize(node: nil, href: nil, previous_header: nil) @node = node - @href = href + @href = CGI.escape(href) if href @children = [] @parent = find_parent(previous_header) |