Skip to content
Snippets Groups Projects

Remove wiki_front_matter FF

Merged David O'Regan requested to merge 353926 into master
All threads resolved!
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
@@ -3,8 +3,6 @@
module Gitlab
module WikiPages
class FrontMatterParser
FEATURE_FLAG = :wiki_front_matter
# We limit the maximum length of text we are prepared to parse as YAML, to
# avoid exploitations and attempts to consume memory and CPU. We allow for:
# - a title line
@@ -30,18 +28,12 @@ def initialize(content:, front_matter: {}, reason: nil, error: nil)
end
# @param [String] wiki_content
# @param [FeatureGate] feature_gate The scope for feature availability
def initialize(wiki_content, feature_gate)
def initialize(wiki_content)
@wiki_content = wiki_content
@feature_gate = feature_gate
end
def self.enabled?(gate = nil)
Feature.enabled?(FEATURE_FLAG, gate)
end
def parse
return empty_result unless enabled? && wiki_content.present?
return empty_result unless wiki_content.present?
return empty_result(block.error) unless block.valid?
Result.new(front_matter: block.data, content: strip_front_matter_block)
@@ -94,16 +86,12 @@ def not_mapping?
private
attr_reader :wiki_content, :feature_gate
attr_reader :wiki_content
def empty_result(reason = nil, error = nil)
Result.new(content: wiki_content, reason: reason, error: error)
end
def enabled?
self.class.enabled?(feature_gate)
end
def block
@block ||= parse_front_matter_block
end
Loading