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 ac39d363ee
commit d2ecf5edcc

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