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
Pipeline #6736 failed with stages
in 3 minutes and 22 seconds
......@@ -46,11 +46,11 @@ defp maybe_parse(html) 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment