Change some instances of Nokogiri HTML4 parsing to HTML5 (#31812)
This commit is contained in:
parent
b716248fc5
commit
10143d053a
8 changed files with 11 additions and 11 deletions
|
@ -25,7 +25,7 @@ class FetchOEmbedService
|
|||
return if html.nil?
|
||||
|
||||
@format = @options[:format]
|
||||
page = Nokogiri::HTML(html)
|
||||
page = Nokogiri::HTML5(html)
|
||||
|
||||
if @format.nil? || @format == :json
|
||||
@endpoint_url ||= page.at_xpath('//link[@type="application/json+oembed"]|//link[@type="text/json+oembed"]')&.attribute('href')&.value
|
||||
|
|
|
@ -73,7 +73,7 @@ class FetchResourceService < BaseService
|
|||
end
|
||||
|
||||
def process_html(response)
|
||||
page = Nokogiri::HTML(response.body_with_limit)
|
||||
page = Nokogiri::HTML5(response.body_with_limit)
|
||||
json_link = page.xpath('//link[@rel="alternate"]').find { |link| ACTIVITY_STREAM_LINK_TYPES.include?(link['type']) }
|
||||
|
||||
process(json_link['href'], terminal: true) unless json_link.nil?
|
||||
|
|
|
@ -100,7 +100,7 @@ class TranslateStatusService < BaseService
|
|||
end
|
||||
|
||||
def unwrap_emoji_shortcodes(html)
|
||||
fragment = Nokogiri::HTML.fragment(html)
|
||||
fragment = Nokogiri::HTML5.fragment(html)
|
||||
fragment.css('span[translate="no"]').each do |element|
|
||||
element.remove_attribute('translate')
|
||||
element.replace(element.children) if element.attributes.empty?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue