add fallback for no content

This commit is contained in:
FloatingGhost 2022-12-14 11:52:35 +00:00
parent 2ace212473
commit d7f1421d2c

View file

@ -30,6 +30,10 @@ def scrub_html_and_truncate(%{data: %{"content" => content}} = object) do
|> scrub_html_and_truncate_object_field(object)
end
def scrub_html_and_truncate(%{data: _}) do
""
end
def scrub_html_and_truncate(content, max_length \\ 200) when is_binary(content) do
content
|> scrub_html