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
Léo-Paul Géneau
gitlab-ce
Commits
73f366e0
Commit
73f366e0
authored
Jul 26, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidate validation logic
parent
3f715bb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
app/controllers/import/bitbucket_server_controller.rb
app/controllers/import/bitbucket_server_controller.rb
+8
-5
No files found.
app/controllers/import/bitbucket_server_controller.rb
View file @
73f366e0
...
...
@@ -82,12 +82,15 @@ class Import::BitbucketServerController < Import::BaseController
def
validate_import_params
@project_key
=
params
[
:project
]
@repo_slug
=
params
[
:repository
]
status
=
:unprocessable_entity
return
render
json:
{
errors:
'Missing project key'
},
status:
status
unless
@project_key
.
present?
&&
@repo_slug
.
present?
return
render
json:
{
errors:
'Missing repository slug'
},
status:
status
unless
@repo_slug
.
present?
return
render
json:
{
errors:
'Invalid project key'
},
status:
status
unless
@project_key
=~
VALID_BITBUCKET_CHARS
return
render
json:
{
errors:
'Invalid repository slug'
},
status:
status
unless
@repo_slug
=~
VALID_BITBUCKET_CHARS
return
render_validation_error
(
'Missing project key'
)
unless
@project_key
.
present?
&&
@repo_slug
.
present?
return
render_validation_error
(
'Missing repository slug'
)
unless
@repo_slug
.
present?
return
render_validation_error
(
'Invalid project key'
)
unless
@project_key
=~
VALID_BITBUCKET_CHARS
return
render_validation_error
(
'Invalid repository slug'
)
unless
@repo_slug
=~
VALID_BITBUCKET_CHARS
end
def
render_validation_error
(
message
)
return
render
json:
{
errors:
message
},
status: :unprocessable_entity
end
def
bitbucket_auth
...
...
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