[ARVADOS] updated: 95a589bcfe740fed72163f3e76e516b8bba5b0cd

git at public.curoverse.com git at public.curoverse.com
Wed Nov 11 18:40:53 EST 2015


Summary of changes:
 .../app/controllers/collections_controller.rb      |   6 +-
 apps/workbench/app/helpers/application_helper.rb   |   2 +-
 .../app/views/collections/_show_files.html.erb     |   2 +-
 apps/workbench/test/helpers/download_helper.rb     |   2 +-
 apps/workbench/test/integration/download_test.rb   |  57 +++++++-
 sdk/cli/bin/arv-run-pipeline-instance              |  33 +++--
 sdk/cli/bin/crunch-job                             |   2 +-
 sdk/go/arvadosclient/arvadosclient.go              | 100 +++++++++----
 sdk/go/arvadosclient/arvadosclient_test.go         | 161 +++++++++++++++++++++
 sdk/python/tests/nginx.conf                        |  12 ++
 sdk/python/tests/run_test_server.py                |   4 +-
 services/fuse/arvados_fuse/fusedir.py              |   7 +-
 services/fuse/bin/arv-mount                        |   9 +-
 services/fuse/tests/test_mount.py                  |  63 ++++++++
 14 files changed, 398 insertions(+), 62 deletions(-)

       via  95a589bcfe740fed72163f3e76e516b8bba5b0cd (commit)
       via  6823c3502d4cb11b7da56740211da299eb100ed9 (commit)
       via  44f985b09a2896e29d31147a6560a03fb4ed2397 (commit)
       via  0d1688a1e1d50d562a34279665069230e0851b16 (commit)
       via  1e2ace543b5614023e30f77d85c19da954cbf1cb (commit)
       via  206451cdcaee133836761024c8517629de429f10 (commit)
       via  3cdc4e8e3668b783f42f887f6a8662b66ecb7f9a (commit)
       via  f5dda9d0b27a65918d53909c265c42f4da2f83e1 (commit)
       via  768f114b1746dddec0f0224dee92a58c8ddc5499 (commit)
       via  9aef039747f280914873b17f8c5b64a44c42fd0a (commit)
       via  9b91a7c2e783595b168a5aa101b4313f9dcce65e (commit)
       via  b1781295959566608326b69440d8d3ae8e4da4ee (commit)
       via  898c73ef5179e3c0cdc088ca369500b40df23b89 (commit)
       via  fe7b78b41bb12070559ebb693c21df18f65f0c99 (commit)
       via  7fae6271dd3b05db5a7f084cf686f7388e2822db (commit)
       via  b958fc62a440d30e4f381f88015acfecaa640b71 (commit)
       via  b5c48c07a2618740eab353150a450fb62bb4ceee (commit)
       via  5d74e7583ad4b2d5dfd9eec50d625eded3739d1c (commit)
       via  c1d63408c611a5ce65dc4de41aeb323c06da2bbc (commit)
       via  ddeed20d869b0d4a8dcd3c763b5dee7158f912ad (commit)
       via  9bc0194676e3f22b41976fefc6146d7dd965d173 (commit)
       via  4c00b4c7c670abe7da5c61e437887a53bbcaadf9 (commit)
       via  a41db1e1945408d33e0b7905e63d2ae9164b1c49 (commit)
       via  4517ed5d2c28870422faf8057d4f6708242cc5a0 (commit)
       via  3ded4c192b1fc655d9fffa225f792055f10f78c9 (commit)
       via  f9577d8ec75fdf861c7dd69ed8cbbc6c3f445669 (commit)
       via  db68fd029f681f380f218b9b2f4fec3a315f140c (commit)
       via  27b9247e0c42700e0c7d94f7721e2164610b1e4c (commit)
       via  4288cc1b9f894d3574be1ac04dab01e70e1a4580 (commit)
       via  ffdfd0ac6e501514c5327c2d6b5f8507bb6353bc (commit)
       via  4197567e7b1fe768896ea6af9c4160b43e8521dd (commit)
       via  579f6139c9c03fe1b08993746c87aa525ff314e9 (commit)
       via  cabef98fc6cec3b9616d0c76ba469184b9dce693 (commit)
       via  c6ec580a9c79d1d21cffa6454d871538ba7c14f0 (commit)
       via  4862071616a002ac4873147ea07109629206584a (commit)
       via  64027668d7b5bd47a863c86277c83961d8a29914 (commit)
      from  51169558811743fcd2e21e4b9397f9fb2d4766b0 (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 95a589bcfe740fed72163f3e76e516b8bba5b0cd
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Nov 11 18:40:42 2015 -0500

    5824: Use attachment instead of inline disposition for image previews.
    
    This allows keep-web to serve private images without wildcard SSL.

diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 14b1c34..16518ec 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -156,7 +156,7 @@ module ApplicationHelper
           collections_for_object(link_uuid).each do |c|
             if c.files.length == 1 and CollectionsHelper::is_image c.files.first[1]
               link_name += " "
-              link_name += image_tag "#{url_for c}/#{CollectionsHelper::file_path c.files.first}", style: "height: 4em; width: auto"
+              link_name += image_tag "#{url_for c}/#{CollectionsHelper::file_path c.files.first}?disposition=attachment", style: "height: 4em; width: auto"
             end
           end
         end
diff --git a/apps/workbench/app/views/collections/_show_files.html.erb b/apps/workbench/app/views/collections/_show_files.html.erb
index e3c79f1..3461e79 100644
--- a/apps/workbench/app/views/collections/_show_files.html.erb
+++ b/apps/workbench/app/views/collections/_show_files.html.erb
@@ -88,7 +88,7 @@
             <i class="fa fa-fw fa-bar-chart-o"></i> <%= filename %></div>
           <div class="collection_files_inline">
             <%= link_to(image_tag("#{url_for @object}/#{file_path}"),
-                        link_params.merge(disposition: 'inline'),
+                        link_params.merge(disposition: 'attachment'),
                         {title: file_path}) %>
           </div>
          </div>

commit 6823c3502d4cb11b7da56740211da299eb100ed9
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Nov 11 18:32:50 2015 -0500

    5824: Fix clear-download-dir helper.

diff --git a/apps/workbench/test/helpers/download_helper.rb b/apps/workbench/test/helpers/download_helper.rb
index 21fb4cd..8f387f4 100644
--- a/apps/workbench/test/helpers/download_helper.rb
+++ b/apps/workbench/test/helpers/download_helper.rb
@@ -6,7 +6,7 @@ module DownloadHelper
   end
 
   def clear
-    FileUtils.rm_f path
+    FileUtils.rm_r path
     begin
       Dir.mkdir path
     rescue Errno::EEXIST

commit 44f985b09a2896e29d31147a6560a03fb4ed2397
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Nov 11 18:32:23 2015 -0500

    5824: Fix path and query escapes.
    
    Paths encode spaces as "%20", not "+".
    
    Rails to_query helper does undesirable things like
    "disposition[]=attachment".

diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 0806a0a..a9e4e3e 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -369,9 +369,9 @@ class CollectionsController < ApplicationController
       uri.path += 't=' + opts[:path_token] + '/'
     end
     uri.path += '_/'
-    uri.path += CGI::escape(file)
+    uri.path += URI.escape(file)
 
-    query = CGI::parse(uri.query || '')
+    query = Hash[URI.decode_www_form(uri.query || '')]
     { query_token: 'api_token',
       disposition: 'disposition' }.each do |opt, param|
       if opts.include? opt
@@ -379,7 +379,7 @@ class CollectionsController < ApplicationController
       end
     end
     unless query.empty?
-      uri.query = query.to_query
+      uri.query = URI.encode_www_form(query)
     end
 
     uri.to_s

commit 0d1688a1e1d50d562a34279665069230e0851b16
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Nov 11 18:29:39 2015 -0500

    5824: Fix -attachment-only-host test config. Test more preview/download variants.

diff --git a/apps/workbench/test/integration/download_test.rb b/apps/workbench/test/integration/download_test.rb
index cf4246c..ed91ae0 100644
--- a/apps/workbench/test/integration/download_test.rb
+++ b/apps/workbench/test/integration/download_test.rb
@@ -2,10 +2,15 @@ require 'integration_helper'
 require 'helpers/download_helper'
 
 class DownloadTest < ActionDispatch::IntegrationTest
+  def getport service
+    File.read(File.expand_path("../../../../../tmp/#{service}.port", __FILE__))
+  end
+
   setup do
-    portfile = File.expand_path '../../../../../tmp/keep-web-ssl.port', __FILE__
-    @kwport = File.read portfile
+    @kwport = getport 'keep-web-ssl'
+    @kwdport = getport 'keep-web-dl-ssl'
     Rails.configuration.keep_web_url = "https://localhost:#{@kwport}/c=%{uuid_or_pdh}"
+    Rails.configuration.keep_web_download_url = "https://localhost:#{@kwdport}/c=%{uuid_or_pdh}"
     CollectionsController.any_instance.expects(:file_enumerator).never
 
     # Make sure Capybara can download files.
@@ -14,21 +19,59 @@ class DownloadTest < ActionDispatch::IntegrationTest
 
     # Keep data isn't populated by fixtures, so we have to write any
     # data we expect to read.
-    unless /^acbd/ =~ `echo -n foo | arv-put --no-progress --raw -` && $?.success?
-      raise $?.to_s
+    ['foo', 'w a z', "Hello world\n"].each do |data|
+      md5 = `echo -n #{data.shellescape} | arv-put --no-progress --raw -`
+      assert_match /^#{Digest::MD5.hexdigest(data)}/, md5
+      assert $?.success?, $?
     end
   end
 
   ['uuid', 'portable_data_hash'].each do |id_type|
-    test "download from keep-web by #{id_type} using a reader token" do
+    test "preview from keep-web by #{id_type} using a reader token" do
       uuid_or_pdh = api_fixture('collections')['foo_file'][id_type]
       token = api_fixture('api_client_authorizations')['active_all_collections']['api_token']
       visit "/collections/download/#{uuid_or_pdh}/#{token}/"
       within "#collection_files" do
-        click_link "foo"
+        click_link 'foo'
       end
-      wait_for_download 'foo', 'foo'
+      assert_no_selector 'a'
+      assert_text 'foo'
+    end
+
+    test "preview anonymous content from keep-web by #{id_type}" do
+      Rails.configuration.anonymous_user_token =
+        api_fixture('api_client_authorizations')['anonymous']['api_token']
+      uuid_or_pdh =
+        api_fixture('collections')['public_text_file'][id_type]
+      visit "/collections/#{uuid_or_pdh}"
+      within "#collection_files" do
+        find('[title~=View]').click
+      end
+      assert_no_selector 'a'
+      assert_text 'Hello world'
+    end
+
+    test "download anonymous content from keep-web by #{id_type}" do
+      Rails.configuration.anonymous_user_token =
+        api_fixture('api_client_authorizations')['anonymous']['api_token']
+      uuid_or_pdh =
+        api_fixture('collections')['public_text_file'][id_type]
+      visit "/collections/#{uuid_or_pdh}"
+      within "#collection_files" do
+        find('[title~=Download]').click
+      end
+      wait_for_download 'Hello world.txt', "Hello world\n"
+    end
+  end
+
+  test "download from keep-web using a session token" do
+    uuid = api_fixture('collections')['w_a_z_file']['uuid']
+    token = api_fixture('api_client_authorizations')['active']['api_token']
+    visit page_with_token('active', "/collections/#{uuid}")
+    within "#collection_files" do
+      find('[title~=Download]').click
     end
+    wait_for_download 'w a z', 'w a z'
   end
 
   def wait_for_download filename, expect_data
diff --git a/sdk/python/tests/nginx.conf b/sdk/python/tests/nginx.conf
index b14c674..2b8b6ca 100644
--- a/sdk/python/tests/nginx.conf
+++ b/sdk/python/tests/nginx.conf
@@ -42,4 +42,16 @@ http {
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     }
   }
+  server {
+    listen *:{{KEEPWEBDLSSLPORT}} ssl default_server;
+    server_name ~.*;
+    ssl_certificate {{SSLCERT}};
+    ssl_certificate_key {{SSLKEY}};
+    location  / {
+      proxy_pass http://keep-web;
+      proxy_set_header Host download:{{KEEPWEBPORT}};
+      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+      proxy_redirect //download:{{KEEPWEBPORT}}/ https://$host:{{KEEPWEBDLSSLPORT}}/;
+    }
+  }
 }
diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py
index a83566a..adb8652 100644
--- a/sdk/python/tests/run_test_server.py
+++ b/sdk/python/tests/run_test_server.py
@@ -508,7 +508,7 @@ def run_keep_web():
     keepweb = subprocess.Popen(
         ['keep-web',
          '-allow-anonymous',
-         '-attachment-only-host=localhost:'+str(keepwebport),
+         '-attachment-only-host=download:'+str(keepwebport),
          '-listen=:'+str(keepwebport)],
         env=env, stdin=open('/dev/null'), stdout=logf, stderr=logf)
     with open(_pidfile('keep-web'), 'w') as f:
@@ -526,6 +526,7 @@ def run_nginx():
         return
     nginxconf = {}
     nginxconf['KEEPWEBPORT'] = _getport('keep-web')
+    nginxconf['KEEPWEBDLSSLPORT'] = find_available_port()
     nginxconf['KEEPWEBSSLPORT'] = find_available_port()
     nginxconf['KEEPPROXYPORT'] = _getport('keepproxy')
     nginxconf['KEEPPROXYSSLPORT'] = find_available_port()
@@ -552,6 +553,7 @@ def run_nginx():
          '-g', 'pid '+_pidfile('nginx')+';',
          '-c', conffile],
         env=env, stdin=open('/dev/null'), stdout=sys.stderr)
+    _setport('keep-web-dl-ssl', nginxconf['KEEPWEBDLSSLPORT'])
     _setport('keep-web-ssl', nginxconf['KEEPWEBSSLPORT'])
     _setport('keepproxy-ssl', nginxconf['KEEPPROXYSSLPORT'])
     _setport('arv-git-httpd-ssl', nginxconf['GITSSLPORT'])

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list