diff --git a/lib/linkify/parser.ex b/lib/linkify/parser.ex index d329e37..1b82f8e 100644 --- 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 index 8692f46..5d83a6a 100644 --- 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