closes #11840
[arvados.git] / services / api / app / controllers / arvados / v1 / collections_controller.rb
index 5c09b1fccdf09f0af508490ac34803efd5b61237..b5dd07e064a71e003b66e81030134dce460e7d4f 100644 (file)
@@ -75,7 +75,13 @@ class Arvados::V1::CollectionsController < ApplicationController
 
   def untrash
     if @object.is_trashed
-      @object.update_attributes!(trash_at: nil)
+      @object.trash_at = nil
+
+      if params[:ensure_unique_name]
+        @object.save_with_unique_name!
+      else
+        @object.save!
+      end
     else
       raise InvalidStateTransitionError
     end