Fix resource preview crash when resource has no image_remote_url

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-06-22 17:13:04 +02:00
parent 7bb8568504
commit 6c6ae7c712
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -287,7 +287,8 @@ defmodule Mobilizon.Service.RichMedia.Parser do
end
@spec check_remote_picture_path(map()) :: map()
defp check_remote_picture_path(%{image_remote_url: image_remote_url, url: url} = data) do
defp check_remote_picture_path(%{image_remote_url: image_remote_url, url: url} = data)
when is_binary(image_remote_url) and is_binary(url) do
Logger.debug("Checking image_remote_url #{image_remote_url}")
data = Map.put(data, :image_remote_url, format_url(url, image_remote_url))