commit: 26f5310379effc184e8e93c13b4f26c3d6528e62
parent b50bd58d707ccaae782b8118a38e3c4f165c3886
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 17 Nov 2020 16:27:47 +0100
parser: Add onion as an extra TLD
Diffstat:
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/linkify/parser.ex b/lib/linkify/parser.ex
@@ -41,7 +41,11 @@ defmodule Linkify.Parser do
"ssb://"
]
- @tlds "./priv/tlds.txt" |> File.read!() |> String.split("\n", trim: true) |> MapSet.new()
+ @tlds "./priv/tlds.txt"
+ |> File.read!()
+ |> String.split("\n", trim: true)
+ |> Enum.concat(["onion"])
+ |> MapSet.new()
@default_opts %{
url: true,
diff --git a/test/parser_test.exs b/test/parser_test.exs
@@ -304,7 +304,7 @@ defmodule Linkify.ParserTest do
"misskey.loki"
]
- def valid_emails, do: ["rms@ai.mit.edu", "vc@cock.li"]
+ def valid_emails, do: ["rms@ai.mit.edu", "vc@cock.li", "guardian@33y6fjyhs3phzfjj.onion"]
def invalid_emails, do: ["rms[at]ai.mit.edu", "vc@cock", "xmpp:lain@trashserver.net"]
- def valid_custom_tld_emails, do: ["guardian@33y6fjyhs3phzfjj.onion", "hi@company.null"]
+ def valid_custom_tld_emails, do: ["hi@company.null"]
end