From 9ea5647df822781f31bbb6750b377de8af6b0937 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Fri, 11 Mar 2022 11:08:37 +0100 Subject: [PATCH] URI.encode is removed, use Addressable::URI.encode See https://github.com/ruby/uri/commit/61c6a47ebf1f2726b60a2bbd70964d64e14b1f98 Co-authored-by: Daniel Donisa --- src/api/app/models/package_file.rb | 2 +- src/api/app/models/project_config_file.rb | 2 +- src/api/app/models/project_file.rb | 2 +- src/api/app/models/project_meta_file.rb | 2 +- src/api/spec/models/backend/file_spec.rb | 2 +- src/api/test/functional/request_controller_test.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api/app/models/package_file.rb b/src/api/app/models/package_file.rb index c2bcd6bf877..1361be220a3 100644 --- a/src/api/app/models/package_file.rb +++ b/src/api/app/models/package_file.rb @@ -6,6 +6,6 @@ class PackageFile < Backend::File # calculates the real url on the backend to search the file def full_path(query = {}) - URI.encode("/source/#{project_name}/#{package_name}/#{name}") + "?#{query.to_query}" + Addressable::URI.encode("/source/#{project_name}/#{package_name}/#{name}") + "?#{query.to_query}" end end diff --git a/src/api/app/models/project_config_file.rb b/src/api/app/models/project_config_file.rb index cb52153a5c0..e313edd2c89 100644 --- a/src/api/app/models/project_config_file.rb +++ b/src/api/app/models/project_config_file.rb @@ -6,7 +6,7 @@ def initialize(attributes = {}) # calculates the real url on the backend to search the file def full_path(query = {}) - URI.encode("/source/#{project_name}/#{name}") + "?#{query.to_query}" + Addressable::URI.encode("/source/#{project_name}/#{name}") + "?#{query.to_query}" end # You dont want to change name of _config diff --git a/src/api/app/models/project_file.rb b/src/api/app/models/project_file.rb index 8243708fb7c..8b11dc8b386 100644 --- a/src/api/app/models/project_file.rb +++ b/src/api/app/models/project_file.rb @@ -11,6 +11,6 @@ class ProjectFile < Backend::File # calculates the real url on the backend to search the file def full_path(query = {}) - URI.encode("/source/#{project_name}/_project/#{name}") + "?#{query.to_query}" + Addressable::URI.encode("/source/#{project_name}/_project/#{name}") + "?#{query.to_query}" end end diff --git a/src/api/app/models/project_meta_file.rb b/src/api/app/models/project_meta_file.rb index 221fb811f3f..8ed4a7045f5 100644 --- a/src/api/app/models/project_meta_file.rb +++ b/src/api/app/models/project_meta_file.rb @@ -6,7 +6,7 @@ def initialize(attributes = {}) # calculates the real url on the backend to search the file def full_path(query = {}) - URI.encode("/source/#{project_name}/#{name}") + "?#{query.to_query}" + Addressable::URI.encode("/source/#{project_name}/#{name}") + "?#{query.to_query}" end # You dont want to change name of _meta diff --git a/src/api/spec/models/backend/file_spec.rb b/src/api/spec/models/backend/file_spec.rb index c6fd6e3cf09..ca63a102bf7 100644 --- a/src/api/spec/models/backend/file_spec.rb +++ b/src/api/spec/models/backend/file_spec.rb @@ -20,7 +20,7 @@ attr_accessor :somefile def full_path(_query) - URI.encode(somefile) + Addressable::URI.encode(somefile) end end end diff --git a/src/api/test/functional/request_controller_test.rb b/src/api/test/functional/request_controller_test.rb index d88b5b57597..20422f3f8e9 100644 --- a/src/api/test/functional/request_controller_test.rb +++ b/src/api/test/functional/request_controller_test.rb @@ -1333,7 +1333,7 @@ def test_search_and_involved_requests assert_xml_tag(tag: 'request', attributes: { id: id }) # via POST - post '/search/request', params: URI.encode("match=(state/@name='new' or state/@name='review') and (action/target/@project='kde4' and action/target/@package='wpa_supplicant')") + post '/search/request', params: Addressable::URI.encode("match=(state/@name='new' or state/@name='review') and (action/target/@project='kde4' and action/target/@package='wpa_supplicant')") assert_response :success assert_xml_tag(tag: 'request', attributes: { id: id })