about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/lib/formatter.rb2
-rw-r--r--spec/lib/formatter_spec.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb
index 2e3587169..6603b8df1 100644
--- a/app/lib/formatter.rb
+++ b/app/lib/formatter.rb
@@ -210,7 +210,7 @@ class Formatter
 
     # Note: I couldn't obtain list_slug with @user/list-name format
     # for mention so this requires additional check
-    special = Extractor.extract_entities_with_indices(escaped, options).map do |extract|
+    special = Extractor.extract_urls_with_indices(escaped, options).map do |extract|
       # exactly one of :url, :hashtag, :screen_name, :cashtag keys is present
       key = (extract.keys & [:url, :hashtag, :screen_name, :cashtag]).first
 
diff --git a/spec/lib/formatter_spec.rb b/spec/lib/formatter_spec.rb
index 9872d3756..8fb6695a9 100644
--- a/spec/lib/formatter_spec.rb
+++ b/spec/lib/formatter_spec.rb
@@ -194,6 +194,14 @@ RSpec.describe Formatter do
         is_expected.to include '/tags/hashtag" class="mention hashtag" rel="tag">#<span>hashtag</span></a>'
       end
     end
+
+    context 'given text containing a hashtag with Unicode chars' do
+      let(:text)  { '#hashtagタグ' }
+
+      it 'creates a hashtag link' do
+        is_expected.to include '/tags/hashtag%E3%82%BF%E3%82%B0" class="mention hashtag" rel="tag">#<span>hashtagタグ</span></a>'
+      end
+    end
   end
 
   describe '#format_spoiler' do