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:
authorRobert Speicher <robert@gitlab.com>2016-07-06 18:06:01 +0300
committerRobert Speicher <robert@gitlab.com>2016-07-06 18:06:01 +0300
commitbe018ba8c4f61babfea494a3946df9931d476a8a (patch)
treecf5acc63374a7a570ae03deaf1800b183806be07 /spec/models
parent400f9f72233c6c5390367a95bf11ebee09c86d2c (diff)
parent54a50bf81d7bb304adaedffd8eb3e0bc0fc348a9 (diff)
Merge branch 'fix/import-url-validator' into 'master'
Fixing URL validation for import_url on projects Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/17536 This MR fixes problems related to bypassing `import_url` validation on projects. This makes sure the URL is properly validated so we don't enter crap and fail while running workers that handle this URL. It also adds a migration to fix current invalid `import_url`s See merge request !4753
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/project_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index a8c777d1e3e..2e89d6de3a2 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -129,6 +129,18 @@ describe Project, models: true do
expect(project2.errors[:repository_storage].first).to match(/is not included in the list/)
end
end
+
+ it 'should not allow an invalid URI as import_url' do
+ project2 = build(:project, import_url: 'invalid://')
+
+ expect(project2).not_to be_valid
+ end
+
+ it 'should allow a valid URI as import_url' do
+ project2 = build(:project, import_url: 'ssh://test@gitlab.com/project.git')
+
+ expect(project2).to be_valid
+ end
end
describe 'default_scope' do