Remove @regexp_timeout_reported from AutoLinkScrubber
No longer needed since the scrubber is not memoized across calls and the text node length guard prevents the performance issue. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,13 +22,12 @@ class AutoLinkScrubber < Loofah::Scrubber
|
|||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@direction = :top_down
|
@direction = :top_down
|
||||||
@regexp_timeout_reported = false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def scrub(node)
|
def scrub(node)
|
||||||
return Loofah::Scrubber::STOP if EXCLUDED_ELEMENTS.include?(node.name)
|
return Loofah::Scrubber::STOP if EXCLUDED_ELEMENTS.include?(node.name)
|
||||||
|
|
||||||
if node.text? && !@regexp_timeout_reported
|
if node.text?
|
||||||
replacement = autolink_text_node(node)
|
replacement = autolink_text_node(node)
|
||||||
node.replace(replacement) if replacement
|
node.replace(replacement) if replacement
|
||||||
end
|
end
|
||||||
@@ -78,7 +77,6 @@ class AutoLinkScrubber < Loofah::Scrubber
|
|||||||
links
|
links
|
||||||
rescue Regexp::TimeoutError => error
|
rescue Regexp::TimeoutError => error
|
||||||
Sentry.capture_exception error if Fizzy.saas?
|
Sentry.capture_exception error if Fizzy.saas?
|
||||||
@regexp_timeout_reported = true
|
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user