diff options
author | Stan Hu <stanhu@gmail.com> | 2017-03-20 22:17:46 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-03-20 22:17:46 -0700 |
commit | 07415e474ed4dc3b6bd1bcfa874c8cdb393855f4 (patch) | |
tree | 3aa3721afd90641e693d55deee8a4085a9fd702a /app/controllers/import | |
parent | 608538437d92902838ff91a6da577f5f3f76c4e6 (diff) | |
download | gitlab-ce-07415e474ed4dc3b6bd1bcfa874c8cdb393855f4.tar.gz |
Fix Error 500 when Bitbucket importer does not have authorization
Closes #29739
Diffstat (limited to 'app/controllers/import')
-rw-r--r-- | app/controllers/import/bitbucket_controller.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb index 8e42cdf415f..5ad1e116e4e 100644 --- a/app/controllers/import/bitbucket_controller.rb +++ b/app/controllers/import/bitbucket_controller.rb @@ -44,15 +44,15 @@ class Import::BitbucketController < Import::BaseController repo_owner = repo.owner repo_owner = current_user.username if repo_owner == bitbucket_client.user.username - @target_namespace = params[:new_namespace].presence || repo_owner + namespace_path = params[:new_namespace].presence || repo_owner - namespace = find_or_create_namespace(@target_namespace, current_user) + @target_namespace = find_or_create_namespace(namespace_path, current_user) - if current_user.can?(:create_projects, namespace) + if current_user.can?(:create_projects, @target_namespace) # The token in a session can be expired, we need to get most recent one because # Bitbucket::Connection class refreshes it. session[:bitbucket_token] = bitbucket_client.connection.token - @project = Gitlab::BitbucketImport::ProjectCreator.new(repo, @project_name, namespace, current_user, credentials).execute + @project = Gitlab::BitbucketImport::ProjectCreator.new(repo, @project_name, @target_namespace, current_user, credentials).execute else render 'unauthorized' end |