Remove HEAD request from fetching link previews (#12028)
It is not really necessary and we need to reduce requests
This commit is contained in:
parent
b258583d2b
commit
9ba40a6bfd
2 changed files with 3 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue