diff options
author | James Lopez <james@jameslopez.es> | 2018-08-29 10:56:30 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-08-29 10:56:30 +0200 |
commit | 971b67ce3128685f2a6ffd888782889bdd173415 (patch) | |
tree | 1454811df647a40bd3530a9e87165857a7437a12 | |
parent | d5632b6b91cbe3936c9ac6886b91adb24ce4013f (diff) | |
download | gitlab-ce-971b67ce3128685f2a6ffd888782889bdd173415.tar.gz |
Fix transfer project redirect loop
-rw-r--r-- | app/services/projects/transfer_service.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb index c2a0c5fa7f3..bf2437aafad 100644 --- a/app/services/projects/transfer_service.rb +++ b/app/services/projects/transfer_service.rb @@ -43,8 +43,8 @@ module Projects @new_path = File.join(@new_namespace.try(:full_path) || '', project.path) @old_namespace = project.namespace - if Project.where(path: project.path, namespace_id: @new_namespace.try(:id)).exists? - raise TransferError.new("Project with same path in target namespace already exists") + if Project.where(namespace_id: @new_namespace.try(:id)).where('path = ? or name = ?', project.path, project.path).exists? + raise TransferError.new("Project with same name or path in target namespace already exists") end if project.has_container_registry_tags? @@ -118,6 +118,7 @@ module Projects def rollback_side_effects rollback_folder_move + project.reload update_namespace_and_visibility(@old_namespace) write_repository_config(@old_path) end |