Fix issue with hostname validation

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-10-20 09:36:57 +02:00
parent 2ad043a91d
commit 2b3d1d7f79
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -241,7 +241,7 @@ defmodule Mobilizon.Service.RichMedia.Parser do
!String.ends_with?(hostname, ".localhost") !String.ends_with?(hostname, ".localhost")
defp validate_hostname_only(hostname), defp validate_hostname_only(hostname),
do: hostname |> String.graphemes() |> Enum.count(&(&1 == "o")) > 0 do: hostname |> String.graphemes() |> Enum.count(&(&1 == ".")) > 0
defp validate_ip(hostname) do defp validate_ip(hostname) do
case hostname |> String.to_charlist() |> :inet.parse_address() do case hostname |> String.to_charlist() |> :inet.parse_address() do