Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-11-03 12:08:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-03 12:08:44 +0300
commitb4c39709e346f437a85829f985f6596cb6209d35 (patch)
tree010b87019e3f523045141f3ce683a1f5d4141499 /app/models/packages
parentea044b0c4c74b91c5d48435254e7fa60aea064ff (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/packages')
-rw-r--r--app/models/packages/protection/rule.rb6
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