diff options
Diffstat (limited to 'lib/gitlab/ci/build')
-rw-r--r-- | lib/gitlab/ci/build/artifacts/metadata.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/ci/build/artifacts/metadata/entry.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab/ci/build/artifacts/metadata.rb b/lib/gitlab/ci/build/artifacts/metadata.rb index 88d624503df..d0ab4916c90 100644 --- a/lib/gitlab/ci/build/artifacts/metadata.rb +++ b/lib/gitlab/ci/build/artifacts/metadata.rb @@ -70,8 +70,8 @@ module Gitlab # abort if we don't get any data. next unless path && meta next unless path.valid_encoding? && meta.valid_encoding? - next unless path =~ match_pattern - next if path =~ INVALID_PATH_PATTERN + next unless match_pattern.match?(path) + next if INVALID_PATH_PATTERN.match?(path) entries[path] = Gitlab::Json.parse(meta, symbolize_names: true) rescue JSON::ParserError, Encoding::CompatibilityError @@ -90,7 +90,7 @@ module Gitlab raise ParserError, 'Artifacts metadata file empty!' end - unless version_string =~ VERSION_PATTERN + unless VERSION_PATTERN.match?(version_string) raise ParserError, 'Invalid version!' end diff --git a/lib/gitlab/ci/build/artifacts/metadata/entry.rb b/lib/gitlab/ci/build/artifacts/metadata/entry.rb index 355fffbf9c6..23db15d58b6 100644 --- a/lib/gitlab/ci/build/artifacts/metadata/entry.rb +++ b/lib/gitlab/ci/build/artifacts/metadata/entry.rb @@ -102,7 +102,7 @@ module Gitlab def total_size descendant_pattern = /^#{Regexp.escape(@path.to_s)}/ entries.sum do |path, entry| - (entry[:size] if path =~ descendant_pattern).to_i + (entry[:size] if descendant_pattern.match?(path)).to_i end end # rubocop: enable CodeReuse/ActiveRecord |