diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-03 12:08:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-03 12:08:44 +0300 |
commit | b4c39709e346f437a85829f985f6596cb6209d35 (patch) | |
tree | 010b87019e3f523045141f3ce683a1f5d4141499 /app/models/packages | |
parent | ea044b0c4c74b91c5d48435254e7fa60aea064ff (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/packages')
-rw-r--r-- | app/models/packages/protection/rule.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/packages/protection/rule.rb b/app/models/packages/protection/rule.rb index 64ec56b989b..f13bcc6e32e 100644 --- a/app/models/packages/protection/rule.rb +++ b/app/models/packages/protection/rule.rb @@ -12,6 +12,12 @@ module Packages validates :package_name_pattern, presence: true, uniqueness: { scope: [:project_id, :package_type] }, length: { maximum: 255 } + validates :package_name_pattern, + format: { + with: Gitlab::Regex.protection_rules_npm_package_name_pattern_regex, + message: ->(_object, _data) { _('should be a valid NPM package name with optional wildcard characters.') } + }, + if: :npm? validates :package_type, presence: true validates :push_protected_up_to_access_level, presence: true |