X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/58ccc8f13d66fc3da1aecb392a6698a29958e203..62790d76daf181a457d8f47741721967cd9cb7d9:/apps/workbench/app/controllers/projects_controller.rb diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb index 323f2a189a..435e0cd5d6 100644 --- a/apps/workbench/app/controllers/projects_controller.rb +++ b/apps/workbench/app/controllers/projects_controller.rb @@ -127,8 +127,23 @@ class ProjectsController < ApplicationController if item.owner_uuid == @object.uuid # Object is owned by this project. Remove it from the project by # changing owner to the current user. - item.update_attributes owner_uuid: current_user.uuid - @removed_uuids << item.uuid + begin + item.update_attributes owner_uuid: current_user.uuid + @removed_uuids << item.uuid + rescue ArvadosApiClient::ApiErrorResponseException => e + if e.message.include? 'collection_owner_uuid_name_unique' + rename_to = item.name + ' removed from ' + + (@object.name ? @object.name : @object.uuid) + + ' at ' + Time.now.to_s + updates = {} + updates[:name] = rename_to + updates[:owner_uuid] = current_user.uuid + item.update_attributes updates + @removed_uuids << item.uuid + else + raise + end + end end end end