summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlieablett <cablett@gitlab.com>2019-05-01 12:15:29 +1200
committercharlieablett <cablett@gitlab.com>2019-05-01 12:15:29 +1200
commit0aff6238f777155750c567ab409d0bce60536526 (patch)
tree7cc0d7af4273a90b9445aa712b136d53671b18e3
parent4b46b530829cc3dd82c2620a76fbe637ca9009c0 (diff)
downloadgitlab-ce-0aff6238f777155750c567ab409d0bce60536526.tar.gz
Change `prohibited_key` to use regexes
-rw-r--r--lib/gitlab/import_export/attribute_cleaner.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/gitlab/import_export/attribute_cleaner.rb b/lib/gitlab/import_export/attribute_cleaner.rb
index 7bdef2b6cdb..c28a1674018 100644
--- a/lib/gitlab/import_export/attribute_cleaner.rb
+++ b/lib/gitlab/import_export/attribute_cleaner.rb
@@ -4,7 +4,7 @@ module Gitlab
module ImportExport
class AttributeCleaner
ALLOWED_REFERENCES = RelationFactory::PROJECT_REFERENCES + RelationFactory::USER_REFERENCES + ['group_id']
- PROHIBITED_SUFFIXES = %w[_id _html].freeze
+ PROHIBITED_REFERENCES = Regexp.union(/\Acached_markdown_version\Z/, /_id\Z/, /_html\Z/).freeze
def self.clean(*args)
new(*args).clean
@@ -25,9 +25,7 @@ module Gitlab
private
def prohibited_key?(key)
- return false if permitted_key?(key)
-
- 'cached_markdown_version' == key || PROHIBITED_SUFFIXES.any? {|suffix| key.end_with?(suffix)}
+ key =~ PROHIBITED_REFERENCES && !permitted_key?(key)
end
def permitted_key?(key)