Skip to content

Commit

Permalink
fix invalid HTML when use 'thumbsup' emoji in comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tdtds committed Jul 3, 2015
1 parent 7347e2f commit 413967f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tdiary/core_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def emojify
if emoji_alias == 'plus1' or emoji_alias == '+1'
emoji_url % (['plus1']*3)
elsif emoji = Emoji.find_by_alias(emoji_alias)
emoji_url % ([emoji.name]*3)
emoji_url % ([CGI.escape(emoji.name)]*3)
else
match
end
Expand Down
7 changes: 7 additions & 0 deletions spec/core/core_ext_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
end
end

context "thumbsupでもemojify" do
before { @result = "いいね!:thumbsup:".emojify }
it do
expect(@result).to eq "いいね!<img src='http://www.emoji-cheat-sheet.com/graphics/emojis/%2B1.png' width='20' height='20' title='%2B1' alt='%2B1' class='emoji' />"
end
end

context "絵文字に変換しない" do
[
":<script type='text/javascript'></script>: は美味しい",
Expand Down

0 comments on commit 413967f

Please sign in to comment.