[ARVADOS] updated: f1eb092c311510b60b8c9b00b64407780e2a0302

git at public.curoverse.com git at public.curoverse.com
Sat Oct 25 10:02:56 EDT 2014


Summary of changes:
 apps/workbench/app/controllers/collections_controller.rb      | 5 ++++-
 apps/workbench/test/functional/collections_controller_test.rb | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

       via  f1eb092c311510b60b8c9b00b64407780e2a0302 (commit)
      from  ef56ac56a0bac0710a486c0e5e9cdd3199eddc61 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit f1eb092c311510b60b8c9b00b64407780e2a0302
Author: radhika <radhika at curoverse.com>
Date:   Sat Oct 25 10:01:40 2014 -0400

    4285: prepend './' to file path being retrieved when it is in a subdir in a collection.

diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 4e0008d..b484df3 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -145,9 +145,12 @@ class CollectionsController < ApplicationController
     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
 
diff --git a/apps/workbench/test/functional/collections_controller_test.rb b/apps/workbench/test/functional/collections_controller_test.rb
index ff53777..e621010 100644
--- a/apps/workbench/test/functional/collections_controller_test.rb
+++ b/apps/workbench/test/functional/collections_controller_test.rb
@@ -206,4 +206,12 @@ class CollectionsControllerTest < ActionController::TestCase
     # 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

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list