Fix issue with hostname validation
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
2ad043a91d
commit
2b3d1d7f79
@ -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