From 82161d8ae54b94be701cba600536d87957361cea Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Sun, 8 Sep 2024 14:56:18 -0400 Subject: [PATCH] Change Account::Field parsing to use HTML5::DocumentFragment (#31813) --- app/models/account/field.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/account/field.rb b/app/models/account/field.rb index 2bada6954..bcd89015d 100644 --- a/app/models/account/field.rb +++ b/app/models/account/field.rb @@ -73,10 +73,10 @@ class Account::Field < ActiveModelSerializers::Model end def extract_url_from_html - doc = Nokogiri::HTML(value).at_xpath('//body') + doc = Nokogiri::HTML5.fragment(value) return if doc.nil? - return if doc.children.size > 1 + return if doc.children.size != 1 element = doc.children.first