3604: Fix up profile and redirect handling.
[arvados.git] / apps / workbench / app / controllers / actions_controller.rb
index e3cdd5589e0312a6040a7af6597b89485ab91a64..d1dc0fca354b7969d77317ec161a58d5f245ea62 100644 (file)
@@ -11,13 +11,15 @@ class ActionsController < ApplicationController
   end
 
   def show
-    @object = model_class.find(params[:uuid])
+    @object = model_class.andand.find(params[:uuid])
     if @object.is_a? Link and
         @object.link_class == 'name' and
         ArvadosBase::resource_class_for_uuid(@object.head_uuid) == Collection
       redirect_to collection_path(id: @object.uuid)
-    else
+    elsif @object
       redirect_to @object
+    else
+      raise ActiveRecord::RecordNotFound
     end
   end
 
@@ -70,7 +72,12 @@ class ActionsController < ApplicationController
           dst.owner_uuid = @object.uuid
           dst.tail_uuid = @object.uuid if dst.class == Link
         end
-        dst.save!
+        begin
+          dst.save!
+        rescue
+          dst.name += " (#{Time.now.localtime})" if dst.respond_to? :name=
+          dst.save!
+        end
       end
     end
     redirect_to @object