Skip to content

Fix link with emoji

Matthias Käppler requested to merge github/fork/ysakasin/master into master

Created by: ysakasin

Fix issue: https://github.com/gitlabhq/gitlabhq/issues/9413 https://gitlab.com/gitlab-org/gitlab-ce/issues/2349

When exec link_to_gfm(':book:Book', '/foo'), The value of gfm_body is:

<img class="emoji" title=":book:" alt=":book:" src="path/to/emoji.png" height="20" width="20" align="absmiddle">Book

The result of Nokogiri::XML::DocumentFragment.parse(gfm_body) is:

<img class="emoji" title=":book:" alt=":book:" src="path/to/emoji.png" height="20" width="20" align="absmiddle">Book</img>

because the img tag has not an end tag and it is not XML. So Nokogiri::HTML::DocumentFragment.parse(gfm_body) is returned the expected value which is img tag and Book.

Merge request reports