Fix issue with hostname validation
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
ac39d363ee
commit
d2ecf5edcc
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user