diff options
author | Stan Hu <stanhu@gmail.com> | 2018-12-06 03:43:29 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-01-29 00:06:27 +0300 |
commit | eafccaad7346d6e1f8d13024bb5295bc683ab046 (patch) | |
tree | 433d6ed6404f8c2edd77a03a6254c2884300974f /app/helpers/import_helper.rb | |
parent | c2b3f64cb44114e69ddeeb453412ad4dd762baf9 (diff) |
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/helpers/import_helper.rb')
-rw-r--r-- | app/helpers/import_helper.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/helpers/import_helper.rb b/app/helpers/import_helper.rb index 49171df1433..d3befd87ccc 100644 --- a/app/helpers/import_helper.rb +++ b/app/helpers/import_helper.rb @@ -8,7 +8,9 @@ module ImportHelper end def sanitize_project_name(name) - name.gsub(/[^\w\-]/, '-') + # For personal projects in Bitbucket in the form ~username, we can + # just drop that leading tilde. + name.gsub(/\A~+/, '').gsub(/[^\w\-]/, '-') end def import_project_target(owner, name) |