diff options
author | Stan Hu <stanhu@gmail.com> | 2018-12-05 16:43:29 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-01-28 13:06:27 -0800 |
commit | eafccaad7346d6e1f8d13024bb5295bc683ab046 (patch) | |
tree | 433d6ed6404f8c2edd77a03a6254c2884300974f /app/controllers/import/bitbucket_server_controller.rb | |
parent | c2b3f64cb44114e69ddeeb453412ad4dd762baf9 (diff) | |
download | gitlab-ce-eafccaad7346d6e1f8d13024bb5295bc683ab046.tar.gz |
Fix Bitbucket Server import not allowing personal projects
Bitbucket Server places personal projects in a namespace called
`~username`. This change allows those projects and also strips
them from the GitLab namespace.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/53419
Diffstat (limited to 'app/controllers/import/bitbucket_server_controller.rb')
-rw-r--r-- | app/controllers/import/bitbucket_server_controller.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/import/bitbucket_server_controller.rb b/app/controllers/import/bitbucket_server_controller.rb index 87338488eba..f333e43b892 100644 --- a/app/controllers/import/bitbucket_server_controller.rb +++ b/app/controllers/import/bitbucket_server_controller.rb @@ -13,7 +13,10 @@ class Import::BitbucketServerController < Import::BaseController # Repository names are limited to 128 characters. They must start with a # letter or number and may contain spaces, hyphens, underscores, and periods. # (https://community.atlassian.com/t5/Answers-Developer-Questions/stash-repository-names/qaq-p/499054) - VALID_BITBUCKET_CHARS = /\A[\w\-_\.\s]+\z/ + # + # Bitbucket Server starts personal project names with a tilde. + VALID_BITBUCKET_PROJECT_CHARS = /\A~?[\w\-\.\s]+\z/ + VALID_BITBUCKET_CHARS = /\A[\w\-\.\s]+\z/ def new end @@ -91,7 +94,7 @@ class Import::BitbucketServerController < Import::BaseController 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 project key') unless @project_key =~ VALID_BITBUCKET_PROJECT_CHARS return render_validation_error('Invalid repository slug') unless @repo_slug =~ VALID_BITBUCKET_CHARS end |