mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: increase chunk size to fetch title tag correctly (#14144)
This commit is contained in:
@@ -11,6 +11,9 @@ module RetrieveTitle
|
||||
|
||||
def self.extract_title(html, encoding = nil)
|
||||
title = nil
|
||||
if html =~ /<title>/ && html !~ /<\/title>/
|
||||
return nil
|
||||
end
|
||||
if doc = Nokogiri::HTML5(html, nil, encoding)
|
||||
|
||||
title = doc.at('title')&.inner_text
|
||||
@@ -44,8 +47,8 @@ module RetrieveTitle
|
||||
return 500 if uri.host =~ /amazon\.(com|ca|co\.uk|es|fr|de|it|com\.au|com\.br|cn|in|co\.jp|com\.mx)$/
|
||||
return 300 if uri.host =~ /youtube\.com$/ || uri.host =~ /youtu.be/
|
||||
|
||||
# default is 10k
|
||||
10
|
||||
# default is 20k
|
||||
20
|
||||
end
|
||||
|
||||
# Fetch the beginning of a HTML document at a url
|
||||
|
||||
Reference in New Issue
Block a user