summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-08-26 15:00:10 +0000
committerRémy Coutable <remy@rymai.me>2018-08-26 15:00:10 +0000
commitec54fd36e991b2c19b4e4d07342a6f3a1de2d8b1 (patch)
tree97c2d31af593fd45f20e250e602bd33302d57a9c /app/helpers
parent5566588f1f0d85044527ffea292044a3bccc69c2 (diff)
parentf2005125dfe7810de910b61dee8d7a9203a6ca6e (diff)
downloadgitlab-ce-ec54fd36e991b2c19b4e4d07342a6f3a1de2d8b1.tar.gz
Merge branch 'sh-sanitize-project-import-names' into 'master'
Use slugs for default project path and sanitize names before import See merge request gitlab-org/gitlab-ce!21367
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/import_helper.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/helpers/import_helper.rb b/app/helpers/import_helper.rb
index 4664b1728c4..c65f1565425 100644
--- a/app/helpers/import_helper.rb
+++ b/app/helpers/import_helper.rb
@@ -5,6 +5,10 @@ module ImportHelper
false
end
+ def sanitize_project_name(name)
+ name.gsub(/[^\w\-]/, '-')
+ end
+
def import_project_target(owner, name)
namespace = current_user.can_create_group? ? owner : current_user.namespace_path
"#{namespace}/#{name}"