forked from AkkomaGang/akkoma
rich media: parser: add some basic sanity checks on the returned data with pattern matching
This commit is contained in:
parent
83b7062634
commit
0f11254a06
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue