From 1147b6c4112bb67348730c72b22b64ff93fd62ee Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 26 Jun 2020 14:42:40 +0200 Subject: [PATCH] Fix opengraph issue Signed-off-by: Thomas Citharel --- lib/service/rich_media/parsers/ogp.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/service/rich_media/parsers/ogp.ex b/lib/service/rich_media/parsers/ogp.ex index 8be34d71d..0b879aab1 100644 --- a/lib/service/rich_media/parsers/ogp.ex +++ b/lib/service/rich_media/parsers/ogp.ex @@ -34,8 +34,9 @@ defmodule Mobilizon.Service.RichMedia.Parsers.OGP do |> Map.put(:height, get_integer_value(data, :"image:height")) end + @spec get_integer_value(Map.t(), atom()) :: integer() | nil defp get_integer_value(data, key) do - with value <- Map.get(data, key), + with value when not is_nil(value) <- Map.get(data, key), {value, ""} <- Integer.parse(value) do value else