parser: Add onion as an extra TLD
This commit is contained in:
parent
b50bd58d70
commit
26f5310379
2 changed files with 7 additions and 3 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue