20846: Merge branch '19213-ubuntu2204-support' into 20846-ubuntu2204
[arvados.git] / apps / workbench / app / controllers / collections_controller.rb
index 10e026ae6c80578e9cd9c933cbb188bd57f1ca94..812b80b8ce739a93066771cdd488243c84da5187 100644 (file)
@@ -258,7 +258,7 @@ class CollectionsController < ApplicationController
       arv_coll.rm "."+p
     end
 
-    if @object.update_attributes manifest_text: arv_coll.manifest_text
+    if @object.update manifest_text: arv_coll.manifest_text
       show
     else
       self.render_error status: 422
@@ -289,7 +289,7 @@ class CollectionsController < ApplicationController
       else
         arv_coll.rename "./"+file_path, new_file_path
 
-        if @object.update_attributes manifest_text: arv_coll.manifest_text
+        if @object.update manifest_text: arv_coll.manifest_text
           show
         else
           self.render_error status: 422
@@ -343,7 +343,7 @@ class CollectionsController < ApplicationController
       # Prefer the attachment-only-host when we want an attachment
       # (and when there is no preview link configured)
       tmpl = Rails.configuration.Services.WebDAVDownload.ExternalURL.to_s
-    elsif not Rails.configuration.Workbench.TrustAllContent
+    elsif not Rails.configuration.Collections.TrustAllContent
       check_uri = URI.parse(tmpl.sub("*", munged_id))
       if opts[:query_token] and
         (check_uri.host.nil? or (
@@ -376,7 +376,7 @@ class CollectionsController < ApplicationController
       uri.path += 't=' + opts[:path_token] + '/'
     end
     uri.path += '_/'
-    uri.path += URI.escape(file) if file
+    uri.path += ERB::Util.url_encode(file).gsub('%2F', '/') if file
 
     query = Hash[URI.decode_www_form(uri.query || '')]
     { query_token: 'api_token',