Change verify link service to use CSS selectors instead of a complex XPath query (#31815)
This commit is contained in:
1 parent
10143d053a
commit
afa2e257e4
2 files changed
+24
-8
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user