mirror of
https://git.pleroma.social/sjw/pleroma.git
synced 2024-12-27 11:56:28 +01:00
rich media: parser: only try to validate strings, not numbers (OEmbed)
This commit is contained in:
parent
4e76f9fde1
commit
46dba03098
@ -54,12 +54,14 @@ defmodule Pleroma.Web.RichMedia.Parser do
|
||||
{:error, "Found metadata was invalid or incomplete: #{inspect(data)}"}
|
||||
end
|
||||
|
||||
defp string_is_valid_unicode(data) do
|
||||
defp string_is_valid_unicode(data) when is_binary(data) do
|
||||
data
|
||||
|> :unicode.characters_to_binary()
|
||||
|> clean_string()
|
||||
end
|
||||
|
||||
defp string_is_valid_unicode(data), do: {:ok, data}
|
||||
|
||||
defp clean_string({:error, _, _}), do: {:error, "Invalid data"}
|
||||
defp clean_string(data), do: {:ok, data}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user