Stop scrubbing after first regexp timeout
This commit is contained in:
@@ -20,12 +20,13 @@ class AutoLinkScrubber < Loofah::Scrubber
|
||||
|
||||
def initialize
|
||||
@direction = :top_down
|
||||
@regexp_timeout_reported = false
|
||||
end
|
||||
|
||||
def scrub(node)
|
||||
return Loofah::Scrubber::STOP if EXCLUDED_ELEMENTS.include?(node.name)
|
||||
|
||||
if node.text?
|
||||
if node.text? && !@regexp_timeout_reported
|
||||
replacement = autolink_text_node(node)
|
||||
node.replace(replacement) if replacement
|
||||
end
|
||||
@@ -73,6 +74,7 @@ class AutoLinkScrubber < Loofah::Scrubber
|
||||
links
|
||||
rescue Regexp::TimeoutError => error
|
||||
Sentry.capture_exception error if Fizzy.saas?
|
||||
@regexp_timeout_reported = true
|
||||
[]
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user