Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
48d76ece
Commit
48d76ece
authored
Jun 22, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
another fix and fixed spec
parent
26b61225
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
app/models/project.rb
app/models/project.rb
+2
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+8
-1
No files found.
app/models/project.rb
View file @
48d76ece
...
@@ -447,6 +447,8 @@ class Project < ActiveRecord::Base
...
@@ -447,6 +447,8 @@ class Project < ActiveRecord::Base
import_url
=
Gitlab
::
UrlSanitizer
.
new
(
value
)
import_url
=
Gitlab
::
UrlSanitizer
.
new
(
value
)
create_or_update_import_data
(
credentials:
import_url
.
credentials
)
create_or_update_import_data
(
credentials:
import_url
.
credentials
)
super
(
import_url
.
sanitized_url
)
super
(
import_url
.
sanitized_url
)
rescue
Addressable
::
URI
::
InvalidURIError
errors
.
add
(
:import_url
,
'must be a valid URL.'
)
end
end
def
import_url
def
import_url
...
...
spec/models/project_spec.rb
View file @
48d76ece
...
@@ -65,7 +65,14 @@ describe Project, models: true do
...
@@ -65,7 +65,14 @@ describe Project, models: true do
end
end
it
'should not allow an invalid URI as import_url'
do
it
'should not allow an invalid URI as import_url'
do
project2
=
build
(
:project
)
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
expect
(
project2
).
to
be_valid
end
end
end
end
...
...
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