add fallback for no content
This commit is contained in:
parent
2ace212473
commit
d7f1421d2c
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue