]> cat aescling's git repositories - mastodon.git/commitdiff
Fix mangling of ##tag matches (#2194) (#2247)
authorMingye Wang <arthur200126@gmail.com>
Fri, 21 Apr 2017 16:18:58 +0000 (12:18 -0400)
committerEugen <eugen@zeonfederated.com>
Fri, 21 Apr 2017 16:18:58 +0000 (18:18 +0200)
This commit fixes hashtag_html so it correctly handles matches with multiple hash-signs.

Bug located by @over9001, initial fix suggested by @nightpool.

app/lib/formatter.rb

index 43893915d4a6f555ba687c44a8d3e0b99dc5818e..f539512a55fab76c8b9809329fa65612da22f408 100644 (file)
@@ -109,7 +109,7 @@ class Formatter
   end
 
   def hashtag_html(match)
-    prefix, affix = match.split('#')
+    prefix, _, affix = match.rpartition('#')
     "#{prefix}<a href=\"#{tag_url(affix.downcase)}\" class=\"mention hashtag\">#<span>#{affix}</span></a>"
   end