Merge branch 'fix-resource-preview-crash' into 'master'

Fix resource preview crash when resource has no image_remote_url

See merge request framasoft/mobilizon!949
This commit is contained in:
Thomas Citharel 2021-06-22 16:53:37 +00:00
commit af0fa8f398

View file

@ -287,7 +287,8 @@ defmodule Mobilizon.Service.RichMedia.Parser do
end end
@spec check_remote_picture_path(map()) :: map() @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}") Logger.debug("Checking image_remote_url #{image_remote_url}")
data = Map.put(data, :image_remote_url, format_url(url, image_remote_url)) data = Map.put(data, :image_remote_url, format_url(url, image_remote_url))