usable_token = find_usable_token(tokens) do
coll = Collection.find(params[:uuid])
end
+
+ file_name = params[:file]
+ file_name = ('./' + file_name) if (file_name and file_name.include?('/'))
if usable_token.nil?
return # Response already rendered.
- elsif params[:file].nil? or not coll.manifest.has_file?(params[:file])
+ elsif file_name.nil? or not coll.manifest.has_file?(file_name)
return render_not_found
end
# runs.
@response.body.length
end
+
+ test "show file in a subdirectory of a collection" do
+ params = collection_params(:collection_with_files_in_subdir, 'subdir2/subdir3/subdir4/file1_in_subdir4.txt')
+ expect_content = stub_file_content
+ get(:show_file, params, session_for(:user1_with_load))
+ assert_response :success
+ assert_equal(expect_content, @response.body, "failed to get a correct file from Keep")
+ end
end