# to read the collection.
opts[:query_token] = usable_token
end
+ opts[:disposition] = params[:disposition]
return redirect_to keep_web_url(params[:uuid], params[:file], opts)
end
end
uri.path += '_/'
uri.path += CGI::escape(file)
- if opts[:query_token]
- uri.query = 'api_token=' + CGI::escape(opts[:query_token])
+
+ query_params = []
+ { query_token: 'api_token',
+ disposition: 'disposition' }.each do |opt, param|
+ if opts[opt]
+ query_params << param + '=' + CGI::escape(opts[opt])
+ end
end
+ unless query_params.empty?
+ uri.query = query_params.join '&'
+ end
+
uri.to_s
end
# download facility.
#
# Examples:
- # keep_web_url: https://%{uuid_or_pdh}.dl.zzzzz.your.domain
- # keep_web_url: https://%{uuid_or_pdh}--dl.zzzzz.your.domain
+ # keep_web_url: https://%{uuid_or_pdh}.collections.uuid_prefix.arvadosapi.com
+ # keep_web_url: https://%{uuid_or_pdh}--collections.uuid_prefix.arvadosapi.com
+ #
+ # Example supporting only public data and collection-sharing links:
+ # keep_web_url: https://collections.uuid_prefix.arvadosapi.com/c=%{uuid_or_pdh}
+ #
+ # Example supporting only download/attachment: (using keep-web
+ # -attachment-only-host collections.uuid_prefix.arvadosapi.com):
+ # keep_web_url: https://collections.uuid_prefix.arvadosapi.com/c=%{uuid_or_pdh}
keep_web_url: false
profile['browser.download.folderList'] = 2 # "save to user-defined location"
profile['browser.download.manager.showWhenStarting'] = false
profile['browser.helperApps.alwaysAsk.force'] = false
+ profile['browser.helperApps.neverAsk.saveToDisk'] = 'text/plain,application/octet-stream'
Capybara::Selenium::Driver.new app, profile: profile
end
"net/http"
"net/url"
"os"
+ "strconv"
"strings"
"git.curoverse.com/arvados.git/sdk/go/arvadosclient"
if rdr, ok := rdr.(keepclient.ReadCloserWithLen); ok {
w.Header().Set("Content-Length", fmt.Sprintf("%d", rdr.Len()))
}
+
+ disposition := "inline"
if attachment {
- w.Header().Set("Content-Disposition", "attachment")
+ disposition = "attachment"
+ }
+ if strings.ContainsRune(r.RequestURI, '?') {
+ // Help the UA realize that the filename is just
+ // "filename.txt", not
+ // "filename.txt?disposition=attachment".
+ //
+ // TODO(TC): Follow advice at RFC 6266 appendix D
+ if basenamePos < 0 {
+ basenamePos = 0
+ }
+ disposition += "; filename=" + strconv.QuoteToASCII(filename[basenamePos:])
+ }
+ if disposition != "inline" {
+ w.Header().Set("Content-Disposition", disposition)
}
w.WriteHeader(http.StatusOK)