Commit 9aa12e3b authored by Abdul Wadood's avatar Abdul Wadood

Remove restrict_special_characters_in_project_path feature flag

Changelog: other
parent 011f0a42
......@@ -497,7 +497,10 @@ class Project < ApplicationRecord
presence: true,
project_path: true,
length: { maximum: 255 }
validate :container_registry_project_path_validation
validates :path,
format: { with: Gitlab::Regex.oci_repository_path_regex,
message: Gitlab::Regex.oci_repository_path_regex_message },
if: :path_changed?
validates :project_feature, presence: true
......@@ -888,14 +891,6 @@ class Project < ApplicationRecord
super
end
def container_registry_project_path_validation
if Feature.enabled?(:restrict_special_characters_in_project_path, self, default_enabled: :yaml) &&
path_changed? &&
!path.match?(Gitlab::Regex.oci_repository_path_regex)
errors.add(:path, Gitlab::Regex.oci_repository_path_regex_message)
end
end
def parent_loaded?
association(:namespace).loaded?
end
......
---
name: restrict_special_characters_in_project_path
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80055
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/353054
milestone: '14.8'
type: development
group: group::workspace
default_enabled: false
......@@ -630,38 +630,6 @@ RSpec.describe Project, factory_default: :keep do
expect(project).not_to be_valid
end
context 'restrict_special_characters_in_project_path feature flag is disabled' do
before do
stub_feature_flags(restrict_special_characters_in_project_path: false)
end
it "allows a path ending in '#{special_character}'" do
project = build(:project, path: "foo#{special_character}")
expect(project).to be_valid
end
end
end
context 'restrict_special_characters_in_project_path feature flag is disabled' do
before do
stub_feature_flags(restrict_special_characters_in_project_path: false)
end
%w[. _].each do |special_character|
it "allows a path starting with '#{special_character}'" do
project = build(:project, path: "#{special_character}foo")
expect(project).to be_valid
end
end
it "rejects a path starting with '-'" do
project = build(:project, path: "-foo")
expect(project).not_to be_valid
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment