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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
816bfd2f
Commit
816bfd2f
authored
Aug 26, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-08-26
parents
35feba41
ec54fd36
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
4 deletions
+23
-4
app/helpers/import_helper.rb
app/helpers/import_helper.rb
+4
-0
app/views/import/_githubish_status.html.haml
app/views/import/_githubish_status.html.haml
+1
-1
app/views/import/bitbucket/status.html.haml
app/views/import/bitbucket/status.html.haml
+1
-1
app/views/import/bitbucket_server/status.html.haml
app/views/import/bitbucket_server/status.html.haml
+1
-1
changelogs/unreleased/sh-sanitize-project-import-names.yml
changelogs/unreleased/sh-sanitize-project-import-names.yml
+5
-0
qa/qa/page/project/import/github.rb
qa/qa/page/project/import/github.rb
+1
-1
spec/helpers/import_helper_spec.rb
spec/helpers/import_helper_spec.rb
+10
-0
No files found.
app/helpers/import_helper.rb
View file @
816bfd2f
...
@@ -5,6 +5,10 @@ module ImportHelper
...
@@ -5,6 +5,10 @@ module ImportHelper
false
false
end
end
def
sanitize_project_name
(
name
)
name
.
gsub
(
/[^\w\-]/
,
'-'
)
end
def
import_project_target
(
owner
,
name
)
def
import_project_target
(
owner
,
name
)
namespace
=
current_user
.
can_create_group?
?
owner
:
current_user
.
namespace_path
namespace
=
current_user
.
can_create_group?
?
owner
:
current_user
.
namespace_path
"
#{
namespace
}
/
#{
name
}
"
"
#{
namespace
}
/
#{
name
}
"
...
...
app/views/import/_githubish_status.html.haml
View file @
816bfd2f
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
=
text_field_tag
:path
,
current_user
.
namespace_path
,
class:
"input-group-text input-large form-control"
,
tabindex:
1
,
disabled:
true
=
text_field_tag
:path
,
current_user
.
namespace_path
,
class:
"input-group-text input-large form-control"
,
tabindex:
1
,
disabled:
true
%span
.input-group-prepend
%span
.input-group-prepend
.input-group-text
/
.input-group-text
/
=
text_field_tag
:path
,
repo
.
name
,
class:
"input-mini form-control"
,
tabindex:
2
,
autofocus:
true
,
required:
true
=
text_field_tag
:path
,
sanitize_project_name
(
repo
.
name
)
,
class:
"input-mini form-control"
,
tabindex:
2
,
autofocus:
true
,
required:
true
%td
.import-actions.job-status
%td
.import-actions.job-status
=
button_tag
class:
"btn btn-import js-add-to-import"
do
=
button_tag
class:
"btn btn-import js-add-to-import"
do
=
has_ci_cd_only_params?
?
_
(
'Connect'
)
:
_
(
'Import'
)
=
has_ci_cd_only_params?
?
_
(
'Connect'
)
:
_
(
'Import'
)
...
...
app/views/import/bitbucket/status.html.haml
View file @
816bfd2f
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
=
text_field_tag
:path
,
current_user
.
namespace_path
,
class:
"input-group-text input-large form-control"
,
tabindex:
1
,
disabled:
true
=
text_field_tag
:path
,
current_user
.
namespace_path
,
class:
"input-group-text input-large form-control"
,
tabindex:
1
,
disabled:
true
%span
.input-group-prepend
%span
.input-group-prepend
.input-group-text
/
.input-group-text
/
=
text_field_tag
:path
,
repo
.
name
,
class:
"input-mini form-control"
,
tabindex:
2
,
autofocus:
true
,
required:
true
=
text_field_tag
:path
,
sanitize_project_name
(
repo
.
slug
)
,
class:
"input-mini form-control"
,
tabindex:
2
,
autofocus:
true
,
required:
true
%td
.import-actions.job-status
%td
.import-actions.job-status
=
button_tag
class:
'btn btn-import js-add-to-import'
do
=
button_tag
class:
'btn btn-import js-add-to-import'
do
=
_
(
'Import'
)
=
_
(
'Import'
)
...
...
app/views/import/bitbucket_server/status.html.haml
View file @
816bfd2f
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
=
text_field_tag
:path
,
current_user
.
namespace_path
,
class:
"input-group-text input-large form-control"
,
tabindex:
1
,
disabled:
true
=
text_field_tag
:path
,
current_user
.
namespace_path
,
class:
"input-group-text input-large form-control"
,
tabindex:
1
,
disabled:
true
%span
.input-group-prepend
%span
.input-group-prepend
.input-group-text
/
.input-group-text
/
=
text_field_tag
:path
,
repo
.
name
,
class:
"input-mini form-control"
,
tabindex:
2
,
autofocus:
true
,
required:
true
=
text_field_tag
:path
,
sanitize_project_name
(
repo
.
slug
)
,
class:
"input-mini form-control"
,
tabindex:
2
,
autofocus:
true
,
required:
true
%td
.import-actions.job-status
%td
.import-actions.job-status
=
button_tag
class:
'btn btn-import js-add-to-import'
do
=
button_tag
class:
'btn btn-import js-add-to-import'
do
Import
Import
...
...
changelogs/unreleased/sh-sanitize-project-import-names.yml
0 → 100644
View file @
816bfd2f
---
title
:
Use slugs for default project path and sanitize names before import
merge_request
:
21367
author
:
type
:
fixed
qa/qa/page/project/import/github.rb
View file @
816bfd2f
...
@@ -14,7 +14,7 @@ module QA
...
@@ -14,7 +14,7 @@ module QA
element
:project_import_row
,
'data: { qa: { repo_path: repo.full_name } }'
element
:project_import_row
,
'data: { qa: { repo_path: repo.full_name } }'
element
:project_namespace_select
element
:project_namespace_select
element
:project_namespace_field
,
'select_tag :namespace_id'
element
:project_namespace_field
,
'select_tag :namespace_id'
element
:project_path_field
,
'text_field_tag :path,
repo.name
'
element
:project_path_field
,
'text_field_tag :path,
sanitize_project_name(repo.name)
'
element
:import_button
,
"_('Import')"
element
:import_button
,
"_('Import')"
end
end
...
...
spec/helpers/import_helper_spec.rb
View file @
816bfd2f
require
'rails_helper'
require
'rails_helper'
describe
ImportHelper
do
describe
ImportHelper
do
describe
'#sanitize_project_name'
do
it
'removes whitespace'
do
expect
(
helper
.
sanitize_project_name
(
'my test repo'
)).
to
eq
(
'my-test-repo'
)
end
it
'removes disallowed characters'
do
expect
(
helper
.
sanitize_project_name
(
'Test&me$over*h_ere'
)).
to
eq
(
'Test-me-over-h_ere'
)
end
end
describe
'#import_project_target'
do
describe
'#import_project_target'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
...
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