diff --git a/lib/linkify/parser.ex b/lib/linkify/parser.ex
index af5afef..cba70f6 100644
--- a/lib/linkify/parser.ex
+++ b/lib/linkify/parser.ex
@@ -301,7 +301,15 @@ defmodule Linkify.Parser do
end
end
- defp valid_url?(url), do: !Regex.match?(@invalid_url, url)
+ defp valid_url?(url) do
+ with {_, [scheme]} <- {:regex, Regex.run(@get_scheme_host, url, capture: [:scheme])},
+ true <- scheme == "" do
+ !Regex.match?(@invalid_url, url)
+ else
+ _ ->
+ true
+ end
+ end
@doc """
Validates a URL's TLD. Returns a boolean.
diff --git a/test/parser_test.exs b/test/parser_test.exs
index 50a6e68..aafecb5 100644
--- a/test/parser_test.exs
+++ b/test/parser_test.exs
@@ -226,6 +226,11 @@ defmodule Linkify.ParserTest do
assert parse(text) == "(check out google.com)"
end
+ test "double dot in link is allowed" do
+ text = "https://example.to/something..mp3"
+ assert parse(text) == "#{text}"
+ end
+
test "do not link urls" do
text = "google.com"
assert parse(text, url: false) == text