diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/models/namespace/package_setting.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/models/namespace/package_setting.rb')
-rw-r--r-- | app/models/namespace/package_setting.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/namespace/package_setting.rb b/app/models/namespace/package_setting.rb index a2064e020b3..881b2f3acb3 100644 --- a/app/models/namespace/package_setting.rb +++ b/app/models/namespace/package_setting.rb @@ -6,13 +6,15 @@ class Namespace::PackageSetting < ApplicationRecord PackageSettingNotImplemented = Class.new(StandardError) - PACKAGES_WITH_SETTINGS = %w[maven].freeze + PACKAGES_WITH_SETTINGS = %w[maven generic].freeze belongs_to :namespace, inverse_of: :package_setting_relation validates :namespace, presence: true validates :maven_duplicates_allowed, inclusion: { in: [true, false] } validates :maven_duplicate_exception_regex, untrusted_regexp: true, length: { maximum: 255 } + validates :generic_duplicates_allowed, inclusion: { in: [true, false] } + validates :generic_duplicate_exception_regex, untrusted_regexp: true, length: { maximum: 255 } class << self def duplicates_allowed?(package) @@ -22,7 +24,7 @@ class Namespace::PackageSetting < ApplicationRecord duplicates_allowed = package.package_settings["#{package.package_type}_duplicates_allowed"] regex = ::Gitlab::UntrustedRegexp.new("\\A#{package.package_settings["#{package.package_type}_duplicate_exception_regex"]}\\z") - duplicates_allowed || regex.match?(package.name) + duplicates_allowed || regex.match?(package.name) || regex.match?(package.version) end end end |