Downcase tags coming in through the TwAPI.
[akkoma] / lib / pleroma / formatter.ex
index 5a241fe457c3bd2a58ec8a89816fa8f0157f39dc..a8149b7b36801f55934f1f82e30badd86931b418 100644 (file)
@@ -1,7 +1,7 @@
 defmodule Pleroma.Formatter do
   alias Pleroma.User
 
-  @link_regex ~r/https?:\/\/[\w\.\/?=\-#]+[\w]/
+  @link_regex ~r/https?:\/\/[\w\.\/?=\-#%&]+[\w]/
   def linkify(text) do
     Regex.replace(@link_regex, text, "<a href='\\0'>\\0</a>")
   end
@@ -9,7 +9,7 @@ defmodule Pleroma.Formatter do
   @tag_regex ~r/\#\w+/u
   def parse_tags(text) do
     Regex.scan(@tag_regex, text)
-    |> Enum.map(fn (["#" <> tag = full_tag]) -> {full_tag, tag} end)
+    |> Enum.map(fn (["#" <> tag = full_tag]) -> {full_tag, String.downcase(tag)} end)
   end
 
   def parse_mentions(text) do