From 3c007c51881e1f89b6a7db3af1a09ecfa96f2631 Mon Sep 17 00:00:00 2001 From: radhika Date: Fri, 9 Jun 2017 18:34:43 -0400 Subject: [PATCH] 11821: it appears that the arv command sometimes sends 'include_trash = "false"', which can be misinterpreted as include_trash != null Arvados-DCO-1.1-Signed-off-by: Radhika Chippada --- .../controllers/arvados/v1/collections_controller.rb | 2 +- .../arvados/v1/collections_controller_test.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/services/api/app/controllers/arvados/v1/collections_controller.rb b/services/api/app/controllers/arvados/v1/collections_controller.rb index 5c09b1fccd..98f453bb5d 100644 --- a/services/api/app/controllers/arvados/v1/collections_controller.rb +++ b/services/api/app/controllers/arvados/v1/collections_controller.rb @@ -22,7 +22,7 @@ class Arvados::V1::CollectionsController < ApplicationController end def find_objects_for_index - if params[:include_trash] || ['destroy', 'trash', 'untrash'].include?(action_name) + if params[:include_trash].andand.==(true || "true") || ['destroy', 'trash', 'untrash'].include?(action_name) @objects = Collection.unscoped.readable_by(*@read_users) end super diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb index 17af916b3d..9ff5845bea 100644 --- a/services/api/test/functional/arvados/v1/collections_controller_test.rb +++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb @@ -1065,4 +1065,14 @@ EOS end end end + + test "get collections with bogus include_trash parameter" do + authorize_with :active + get :index, { + filters: [["is_trashed", "=", true]], + include_trash: "false", + } + assert_response :success + assert_operator json_response["items"].count, :==, 0 + end end -- 2.30.2