aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/rich_media/parser.ex
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2020-06-15 16:03:40 +0400
committerEgor Kislitsyn <egor@kislitsyn.com>2020-06-15 16:03:40 +0400
commit58e4e3db8b04933129303d0ad9da74b43cbb4003 (patch)
tree28cc28e116b8a8091e686ebc7a17f3c783d7ad04 /lib/pleroma/web/rich_media/parser.ex
parent09d31d24de568aac06fe203beeb8bb2a9de8f602 (diff)
parent448e93ce2c1eab9eb91118b90f661c31056e4781 (diff)
downloadpleroma-58e4e3db8b04933129303d0ad9da74b43cbb4003.tar.gz
Merge remote-tracking branch 'origin/develop' into merge-ogp-twitter-parsers
Diffstat (limited to 'lib/pleroma/web/rich_media/parser.ex')
-rw-r--r--lib/pleroma/web/rich_media/parser.ex12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/pleroma/web/rich_media/parser.ex b/lib/pleroma/web/rich_media/parser.ex
index 78e9048f3..ef5ead2da 100644
--- a/lib/pleroma/web/rich_media/parser.ex
+++ b/lib/pleroma/web/rich_media/parser.ex
@@ -91,7 +91,7 @@ defmodule Pleroma.Web.RichMedia.Parser do
html
|> parse_html()
|> maybe_parse()
- |> Map.put(:url, url)
+ |> Map.put("url", url)
|> clean_parsed_data()
|> check_parsed_data()
rescue
@@ -111,8 +111,8 @@ defmodule Pleroma.Web.RichMedia.Parser do
end)
end
- defp check_parsed_data(%{title: title} = data)
- when is_binary(title) and byte_size(title) > 0 do
+ defp check_parsed_data(%{"title" => title} = data)
+ when is_binary(title) and title != "" do
{:ok, data}
end
@@ -123,11 +123,7 @@ defmodule Pleroma.Web.RichMedia.Parser do
defp clean_parsed_data(data) do
data
|> Enum.reject(fn {key, val} ->
- with {:ok, _} <- Jason.encode(%{key => val}) do
- false
- else
- _ -> true
- end
+ not match?({:ok, _}, Jason.encode(%{key => val}))
end)
|> Map.new()
end