X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f291a43f7154d634a417bff32b9b81c197feb461..1471ad4b235e168ccee4fa351b0025b2b380d7ac:/apps/workbench/app/controllers/collections_controller.rb diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb index 8da1a20b33..0a7f22b957 100644 --- a/apps/workbench/app/controllers/collections_controller.rb +++ b/apps/workbench/app/controllers/collections_controller.rb @@ -115,20 +115,10 @@ class CollectionsController < ApplicationController end def show_file_links - if Rails.configuration.keep_web_url || Rails.configuration.keep_web_download_url - # show_file will redirect to keep-web's directory listing - return show_file - end - Thread.current[:reader_tokens] = [params[:reader_token]] - return if false.equal?(find_object_by_uuid) - render layout: false + return show_file end def show_file - # We pipe from arv-get to send the file to the user. Before we start it, - # we ask the API server if the file actually exists. This serves two - # purposes: it lets us return a useful status code for common errors, and - # helps us figure out which token to provide to arv-get. # The order of searched tokens is important: because the anonymous user # token is passed along with every API request, we have to check it first. # Otherwise, it's impossible to know whether any other request succeeded @@ -145,23 +135,18 @@ class CollectionsController < ApplicationController return end - # If we are configured to use a keep-web server, just redirect to - # the appropriate URL. - if Rails.configuration.keep_web_url or - Rails.configuration.keep_web_download_url - opts = {} - if usable_token == params[:reader_token] - opts[:path_token] = usable_token - elsif usable_token == Rails.configuration.anonymous_user_token - # Don't pass a token at all - else - # We pass the current user's real token only if it's necessary - # to read the collection. - opts[:query_token] = usable_token - end - opts[:disposition] = params[:disposition] if params[:disposition] - return redirect_to keep_web_url(params[:uuid], params[:file], opts) + opts = {} + if usable_token == params[:reader_token] + opts[:path_token] = usable_token + elsif usable_token == Rails.configuration.anonymous_user_token + # Don't pass a token at all + else + # We pass the current user's real token only if it's necessary + # to read the collection. + opts[:query_token] = usable_token end + opts[:disposition] = params[:disposition] if params[:disposition] + return redirect_to keep_web_url(params[:uuid], params[:file], opts) end def sharing_scopes @@ -249,11 +234,7 @@ class CollectionsController < ApplicationController def download_link token = @search_sharing.first.api_token - if Rails.configuration.keep_web_url || Rails.configuration.keep_web_download_url - keep_web_url(@object.uuid, nil, {path_token: token}) - else - collections_url + "/download/#{@object.uuid}/#{token}/" - end + keep_web_url(@object.uuid, nil, {path_token: token}) end def share @@ -319,30 +300,6 @@ class CollectionsController < ApplicationController end end - def tags - render - end - - def save_tags - tags_param = params['tag_data'] - if tags_param - if tags_param.is_a?(String) && tags_param == "empty" - tags = {} - else - tags = tags_param - end - end - - if tags - if @object.update_attributes properties: tags - @saved_tags = true - render - else - self.render_error status: 422 - end - end - end - protected def find_usable_token(token_list)