]> cat aescling's git repositories - mastodon.git/commitdiff
Ignore HEAD method if does not support (#5949)
authorYamagishi Kazutoshi <ykzts@desire.sh>
Sat, 9 Dec 2017 15:53:40 +0000 (00:53 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 9 Dec 2017 15:53:40 +0000 (16:53 +0100)
app/services/fetch_link_card_service.rb

index cec96d927727459f893c8177fc69de5dce6ced73..7f4518ea7f75b44e00709f429aa5915860ee6dbe 100644 (file)
@@ -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