18865: Fix 422 on nonexistent link uuid.
authorTom Clegg <tom@curii.com>
Fri, 25 Mar 2022 18:54:05 +0000 (14:54 -0400)
committerTom Clegg <tom@curii.com>
Fri, 25 Mar 2022 18:54:05 +0000 (14:54 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/api/app/controllers/arvados/v1/links_controller.rb

index 14e010640e6b665fa0409005fa419ce6b3f808b4..64e070999aa8cbfc7d093c6aa20f8d444492dd61 100644 (file)
@@ -58,7 +58,9 @@ class Arvados::V1::LinksController < ApplicationController
       # user or (b) its head_uuid is an object the current_user
       # can_manage.
       @object = Link.unscoped.where(uuid: params[:uuid]).first
-      if @object.link_class != 'permission'
+      if @object && @object.link_class != 'permission'
+        # Throw this out and re-fetch using generic permission query
+        @object = nil
         super
       elsif @object &&
          current_user.uuid != @object.tail_uuid &&