Filter the parsed OpenGraph/Twittercard tags and only retain the ones we intend to use.
This commit is contained in:
parent
2137b681dc
commit
ac0882e348
4 changed files with 13 additions and 18 deletions
|
|
@ -11,5 +11,16 @@ defmodule Pleroma.Web.RichMedia.Parsers.TwitterCard do
|
|||
|> MetaTagsParser.parse(html, "og", "property")
|
||||
|> MetaTagsParser.parse(html, "twitter", "name")
|
||||
|> MetaTagsParser.parse(html, "twitter", "property")
|
||||
|> filter_tags()
|
||||
end
|
||||
|
||||
defp filter_tags(tags) do
|
||||
Map.filter(tags, fn {k, _v} ->
|
||||
cond do
|
||||
k in ["card", "description", "image", "title", "ttl", "type", "url"] -> true
|
||||
String.starts_with?(k, "image:") -> true
|
||||
true -> false
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue