Change verify link service to use CSS selectors instead of a complex XPath query (#31815)
This commit is contained in:
parent
10143d053a
commit
afa2e257e4
2 changed files with 24 additions and 8 deletions
|
@ -26,7 +26,7 @@ class VerifyLinkService < BaseService
|
|||
def link_back_present?
|
||||
return false if @body.blank?
|
||||
|
||||
links = Nokogiri::HTML5(@body).xpath('//a[contains(concat(" ", normalize-space(@rel), " "), " me ")]|//link[contains(concat(" ", normalize-space(@rel), " "), " me ")]')
|
||||
links = Nokogiri::HTML5(@body).css("a[rel~='me'],link[rel~='me']")
|
||||
|
||||
if links.any? { |link| link['href']&.downcase == @link_back.downcase }
|
||||
true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue