merge only if page_url is an absolute path

This commit is contained in:
rinpatch 2019-02-02 11:53:46 +03:00
parent cbadf9d333
commit e4d18f328b

View file

@ -186,8 +186,12 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
page_url_data = URI.parse(page_url)
image_url =
URI.merge(page_url_data, URI.parse(rich_media[:image]))
|> to_string
if %URI{host: nil} = page_url_data do
rich_media[:image]
else
URI.merge(page_url_data, URI.parse(rich_media[:image]))
|> to_string
end
site_name = rich_media[:site_name] || page_url_data.host