Commit b33a4da3 authored by Douwe Maan's avatar Douwe Maan

Merge branch '48269-wiki-page-returns-error-code-502' into 'master'

Resolve "Wiki page returns error code 502"

Closes #48269

See merge request gitlab-org/gitlab-ce!20174
parents 0fbbbc5f 990a2a7b
---
title: Remove performance bottleneck preventing large wiki pages from displaying
merge_request: 20174
author:
type: performance
......@@ -56,10 +56,12 @@ module Banzai
# Pattern to match allowed image extensions
ALLOWED_IMAGE_EXTENSIONS = /.+(jpg|png|gif|svg|bmp)\z/i.freeze
# Do not perform linking inside these tags.
IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set
def call
doc.search(".//text()").each do |node|
# Do not perform linking inside <code> blocks
next unless node.ancestors('code').empty?
next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS)
# A Gollum ToC tag is `[[_TOC_]]`, but due to MarkdownFilter running
# before this one, it will be converted into `[[<em>TOC</em>]]`, so it
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment