From 971b67ce3128685f2a6ffd888782889bdd173415 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Wed, 29 Aug 2018 10:56:30 +0200 Subject: Fix transfer project redirect loop --- app/services/projects/transfer_service.rb | 5 +++-- 1 file 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 -- cgit v1.2.1