mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 06:58:58 +00:00
rich media: parser: add some basic sanity checks on the returned data with pattern matching
This commit is contained in:
parent
83b7062634
commit
0f11254a06
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue