From e7d55df38d8c18819e79646bb7d1365c5eab54f3 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sun, 10 Dec 2017 00:53:40 +0900 Subject: [PATCH] Ignore HEAD method if does not support (#5949) --- app/services/fetch_link_card_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb index cec96d9277..7f4518ea7f 100644 --- a/app/services/fetch_link_card_service.rb +++ b/app/services/fetch_link_card_service.rb @@ -38,7 +38,7 @@ class FetchLinkCardService < BaseService @card ||= PreviewCard.new(url: @url) res = Request.new(:head, @url).perform - return if res.code != 200 || res.mime_type != 'text/html' + return if res.code != 405 && (res.code != 200 || res.mime_type != 'text/html') attempt_oembed || attempt_opengraph end