|
|
@ -13,6 +13,10 @@ class FetchLinkCardService < BaseService
|
|
|
|
|
|
|
|
|
|
|
|
url = Addressable::URI.parse(url).normalize.to_s
|
|
|
|
url = Addressable::URI.parse(url).normalize.to_s
|
|
|
|
card = PreviewCard.where(status: status).first_or_initialize(status: status, url: url)
|
|
|
|
card = PreviewCard.where(status: status).first_or_initialize(status: status, url: url)
|
|
|
|
|
|
|
|
res = http_client.head(url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return if res.code != 200 || res.mime_type != 'text/html'
|
|
|
|
|
|
|
|
|
|
|
|
attempt_opengraph(card, url) unless attempt_oembed(card, url)
|
|
|
|
attempt_opengraph(card, url) unless attempt_oembed(card, url)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|