From 5c9aa2b7329fe5bd87cee583e33c7b5c1eac4566 Mon Sep 17 00:00:00 2001
From: Mingye Wang <arthur200126@gmail.com>
Date: Fri, 21 Apr 2017 12:18:58 -0400
Subject: [PATCH] Fix mangling of ##tag matches (#2194) (#2247)

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb
index 43893915d..f539512a5 100644
--- a/app/lib/formatter.rb
+++ b/app/lib/formatter.rb
@@ -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
 
-- 
GitLab