From 6c1945b57e2ab6a74f02910cb31dc2adeaf4d31a Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Mon, 17 Aug 2026 18:59:03 +0900 Subject: [PATCH 1/3] Fix formatting a text being much slower in 7.0.0 when its container has many attachments --- lib/redmine/wiki_formatting/common_mark/formatter.rb | 3 ++- lib/redmine/wiki_formatting/textile/formatter.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/redmine/wiki_formatting/common_mark/formatter.rb b/lib/redmine/wiki_formatting/common_mark/formatter.rb index a4941d4fd..3efc0e09a 100644 --- a/lib/redmine/wiki_formatting/common_mark/formatter.rb +++ b/lib/redmine/wiki_formatting/common_mark/formatter.rb @@ -75,8 +75,9 @@ module Redmine fragment = Redmine::WikiFormatting::HtmlParser.parse(html) SANITIZER.call(fragment) + scrubbers = SCRUBBERS + post_processor_scrubbers scrubber = Loofah::Scrubber.new do |node| - (SCRUBBERS + post_processor_scrubbers).each do |s| + scrubbers.each do |s| result = s.scrub(node) break result if result == Loofah::Scrubber::STOP break if node.parent.nil? diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb index c1bd7d03f..93598f3c1 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.rb @@ -41,8 +41,9 @@ module Redmine html = @filter.to_html(rules) fragment = Loofah.html5_fragment(html) + scrubbers = SCRUBBERS + post_processor_scrubbers scrubber = Loofah::Scrubber.new do |node| - (SCRUBBERS + post_processor_scrubbers).each do |s| + scrubbers.each do |s| result = s.scrub(node) break result if result == Loofah::Scrubber::STOP break if node.parent.nil? -- 2.50.1