diff options
author | Stan Hu <stanhu@gmail.com> | 2018-07-24 12:58:31 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-24 13:00:49 -0700 |
commit | be495c6a80fadd6c741b82c7e9d585f3f1ab349b (patch) | |
tree | b03a82ca958aba4b17f64feaa76eafcdc26b3c03 /lib | |
parent | c06e2ac888fb5180cdf133df89d03b99eceafa0d (diff) | |
download | gitlab-ce-be495c6a80fadd6c741b82c7e9d585f3f1ab349b.tar.gz |
Fix slow Markdown rendering
The sanitize transformers were being duplicated each time the Markdown
renderer was called, leading to expontential growth in rendering times.
The problem was that although HTML::Pipeline::SanitizationFilter.WHITELIST
is a frozen hash, the `:transformers` array can be modified. We need
to do deep copy of this to avoid adding duplicates.
Closes #49409
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/filter/sanitization_filter.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/banzai/filter/sanitization_filter.rb b/lib/banzai/filter/sanitization_filter.rb index 80b9d3d045f..8ba09290e6d 100644 --- a/lib/banzai/filter/sanitization_filter.rb +++ b/lib/banzai/filter/sanitization_filter.rb @@ -13,7 +13,7 @@ module Banzai def whitelist strong_memoize(:whitelist) do - customize_whitelist(super.dup) + customize_whitelist(super.deep_dup) end end |