forked from AkkomaGang/akkoma
rich media: parser: only try to validate strings, not numbers (OEmbed)
This commit is contained in:
parent
4e76f9fde1
commit
46dba03098
1 changed files with 3 additions and 1 deletions
|
@ -54,12 +54,14 @@ defp check_parsed_data(data) do
|
||||||
{:error, "Found metadata was invalid or incomplete: #{inspect(data)}"}
|
{:error, "Found metadata was invalid or incomplete: #{inspect(data)}"}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp string_is_valid_unicode(data) do
|
defp string_is_valid_unicode(data) when is_binary(data) do
|
||||||
data
|
data
|
||||||
|> :unicode.characters_to_binary()
|
|> :unicode.characters_to_binary()
|
||||||
|> clean_string()
|
|> clean_string()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp string_is_valid_unicode(data), do: {:ok, data}
|
||||||
|
|
||||||
defp clean_string({:error, _, _}), do: {:error, "Invalid data"}
|
defp clean_string({:error, _, _}), do: {:error, "Invalid data"}
|
||||||
defp clean_string(data), do: {:ok, data}
|
defp clean_string(data), do: {:ok, data}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue