about summary refs log tree commit diff
path: root/app/lib/formatter.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-07-19 12:09:41 +0200
committerGitHub <noreply@github.com>2021-07-19 12:09:41 +0200
commita2df067f9852f0db3140dd2c35539f4e74bdb6dc (patch)
treec18376b570831e1595362f001341599f1a5a8a36 /app/lib/formatter.rb
parente42ed4502f9e4a599ecf7a860b7de80090ba46ad (diff)
parentd1c87be8cf0837f96290b5c2e127b7ce2e3dbb41 (diff)
Merge pull request #1569 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/lib/formatter.rb')
-rw-r--r--app/lib/formatter.rb31
1 files changed, 1 insertions, 30 deletions
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb
index b26138642..f2c4beed5 100644
--- a/app/lib/formatter.rb
+++ b/app/lib/formatter.rb
@@ -279,39 +279,10 @@ class Formatter
     result.flatten.join
   end
 
-  UNICODE_ESCAPE_BLACKLIST_RE = /\p{Z}|\p{P}/
-
   def utf8_friendly_extractor(text, options = {})
-    old_to_new_index = [0]
-
-    escaped = text.chars.map do |c|
-      output = begin
-        if c.ord.to_s(16).length > 2 && !UNICODE_ESCAPE_BLACKLIST_RE.match?(c)
-          CGI.escape(c)
-        else
-          c
-        end
-      end
-
-      old_to_new_index << old_to_new_index.last + output.length
-
-      output
-    end.join
-
     # Note: I couldn't obtain list_slug with @user/list-name format
     # for mention so this requires additional check
-    special = Extractor.extract_urls_with_indices(escaped, options).map do |extract|
-      new_indices = [
-        old_to_new_index.find_index(extract[:indices].first),
-        old_to_new_index.find_index(extract[:indices].last),
-      ]
-
-      next extract.merge(
-        indices: new_indices,
-        url: text[new_indices.first..new_indices.last - 1]
-      )
-    end
-
+    special = Extractor.extract_urls_with_indices(text, options)
     standard = Extractor.extract_entities_with_indices(text, options)
     extra = Extractor.extract_extra_uris_with_indices(text, options)