Skip to content
Snippets Groups Projects
Commit 0f11254a authored by kaniini's avatar kaniini
Browse files

rich media: parser: add some basic sanity checks on the returned data with pattern matching

parent 83b70626
No related branches found
No related tags found
No related merge requests found
......@@ -46,11 +46,11 @@ defmodule Pleroma.Web.RichMedia.Parser do
end)
end
defp get_parsed_data(data) when data == %{} do
{:error, "No metadata found"}
defp get_parsed_data(%{title: title} = data) when is_binary(title) and byte_size(title) > 0 do
{:ok, data}
end
defp get_parsed_data(data) do
{:ok, data}
{:error, "Found metadata was invalid or incomplete: #{inspect(data)}"}
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment