0
0
Fork 0

Remove HEAD request from fetching link previews (#12028)

It is not really necessary and we need to reduce requests
This commit is contained in:
Eugen Rochko 2019-10-01 04:54:10 +02:00 committed by GitHub
parent b258583d2b
commit 9ba40a6bfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 16 deletions

View file

@ -39,12 +39,6 @@ class FetchLinkCardService < BaseService
def process_url
@card ||= PreviewCard.new(url: @url)
failed = Request.new(:head, @url).perform do |res|
res.code != 405 && res.code != 501 && (res.code != 200 || res.mime_type != 'text/html')
end
return if failed
Request.new(:get, @url).perform do |res|
if res.code == 200 && res.mime_type == 'text/html'
@html = res.body_with_limit