BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
68873d74
Commit
68873d74
authored
Mar 10, 2017
by
Douwe Maan
Committed by
DJ Mountney
Mar 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'tc-fix-project-create-500' into 'master'
Fix for creating a project through API when import_url is nil Closes #29121 See merge request !9841
parent
0f711b08
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
0 deletions
+22
-0
tc-fix-project-create-500.yml
changelogs/unreleased/tc-fix-project-create-500.yml
+4
-0
url_sanitizer.rb
lib/gitlab/url_sanitizer.rb
+2
-0
url_sanitizer_spec.rb
spec/lib/gitlab/url_sanitizer_spec.rb
+8
-0
projects_spec.rb
spec/requests/api/projects_spec.rb
+8
-0
No files found.
changelogs/unreleased/tc-fix-project-create-500.yml
0 → 100644
View file @
68873d74
---
title
:
Fix for creating a project through API when import_url is nil
merge_request
:
9841
author
:
lib/gitlab/url_sanitizer.rb
View file @
68873d74
...
...
@@ -9,6 +9,8 @@ module Gitlab
end
def
self
.
valid?
(
url
)
return
false
unless
url
Addressable
::
URI
.
parse
(
url
.
strip
)
true
...
...
spec/lib/gitlab/url_sanitizer_spec.rb
View file @
68873d74
...
...
@@ -100,4 +100,12 @@ describe Gitlab::UrlSanitizer, lib: true do
it
{
expect
(
url_sanitizer
.
full_url
).
to
eq
(
"https://john.doe@github.com/me/project.git"
)
}
end
end
describe
'.valid?'
do
it
'validates url strings'
do
expect
(
described_class
.
valid?
(
nil
)).
to
be
(
false
)
expect
(
described_class
.
valid?
(
'valid@project:url.git'
)).
to
be
(
true
)
expect
(
described_class
.
valid?
(
'123://invalid:url'
)).
to
be
(
false
)
end
end
end
spec/requests/api/projects_spec.rb
View file @
68873d74
...
...
@@ -424,6 +424,14 @@ describe API::Projects, api: true do
expect
(
json_response
[
'only_allow_merge_if_all_discussions_are_resolved'
]).
to
be_truthy
end
it
'ignores import_url when it is nil'
do
project
=
attributes_for
(
:project
,
{
import_url:
nil
})
post
api
(
'/projects'
,
user
),
project
expect
(
response
).
to
have_http_status
(
201
)
end
context
'when a visibility level is restricted'
do
let
(
:project_param
)
{
attributes_for
(
:project
,
visibility:
'public'
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment