Commit 6cac8e3c authored by lain's avatar lain
Browse files

Downcase tags coming in through the TwAPI.

parent 5ff4a5ee
......@@ -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
......
......@@ -16,9 +16,9 @@ defmodule Pleroma.FormatterTest do
describe ".parse_tags" do
test "parses tags in the text" do
text = "Here's a #test. Maybe these are #working or not. What about #漢字? And #は。"
text = "Here's a #Test. Maybe these are #working or not. What about #漢字? And #は。"
expected = [
{"#test", "test"},
{"#Test", "test"},
{"#working", "working"},
{"#漢字", "漢字"},
{"#は", "は"}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment