From 63129b0769bc80edc12df66f3f6a3dad41eac0cc Mon Sep 17 00:00:00 2001 From: 778a69cd <778a69cd@potsda.mn> Date: Sat, 9 Dec 2023 21:48:23 +0100 Subject: [PATCH] fix: allow html_to_text to receive nil, e.g. for empty event descriptions Fixes https://git.potsda.mn/potsda.mn/mobilizon/issues/34 --- lib/service/formatter/html.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/service/formatter/html.ex b/lib/service/formatter/html.ex index 67948d030..7ee4a3a81 100644 --- a/lib/service/formatter/html.ex +++ b/lib/service/formatter/html.ex @@ -42,6 +42,7 @@ defmodule Mobilizon.Service.Formatter.HTML do def strip_tags_and_insert_spaces(html), do: html @spec html_to_text(String.t()) :: String.t() + def html_to_text(nil), do: nil def html_to_text(html) do html |> String.replace(~r/
  • /, "\\g{1}- ", global: true)