From 9f35659c07e5c4cdbc4660292ea6b812e740f109 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Thu, 28 May 2020 22:37:42 -0700 Subject: Fix warnings for upcoming ruby version Ruby 2.7 made some deprecation warnings verbose and they become visible to users e.g.: remote: gitlab-gitaly/ruby/gitlab-shell/lib/httpunix.rb:15: warning: URI.unescape is obsolete remote: gitlab-gitaly/ruby/gitlab-shell/lib/gitlab_net.rb:63: warning: Passing the keyword argument as the last hash parameter is deprecated remote: gitlab-gitaly/ruby/gitlab-shell/lib/http_helper.rb:98: warning: The called method `post' is defined here remote: gitlab-gitaly/ruby/gitlab-shell/lib/httpunix.rb:15: warning: URI.unescape is obsolete remote: gitlab-gitaly/ruby/gitlab-shell/lib/httpunix.rb:15: warning: URI.unescape is obsolete Fix the warnings. TESTS: unittests, manually by pushing to a gitlab server Signed-off-by: Anatol Pomozov --- ruby/gitlab-shell/lib/gitlab_net.rb | 2 +- ruby/gitlab-shell/lib/httpunix.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ruby/gitlab-shell/lib/gitlab_net.rb b/ruby/gitlab-shell/lib/gitlab_net.rb index 812be9ae8..f9f7e8bc5 100644 --- a/ruby/gitlab-shell/lib/gitlab_net.rb +++ b/ruby/gitlab-shell/lib/gitlab_net.rb @@ -60,7 +60,7 @@ class GitlabNet # rubocop:disable Metrics/ClassLength end def pre_receive(gl_repository) - resp = post("#{internal_api_endpoint}/pre_receive", gl_repository: gl_repository) + resp = post("#{internal_api_endpoint}/pre_receive", { gl_repository: gl_repository }) raise NotFound if resp.code == '404' diff --git a/ruby/gitlab-shell/lib/httpunix.rb b/ruby/gitlab-shell/lib/httpunix.rb index 7d00f71d5..060af8bbb 100644 --- a/ruby/gitlab-shell/lib/httpunix.rb +++ b/ruby/gitlab-shell/lib/httpunix.rb @@ -4,7 +4,7 @@ # http://fixall.online/theres-no-need-to-reinvent-the-wheelhttpsgithubcommsabramorequests-unixsocketurl/241810/ # https://github.com/msabramo/requests-unixsocket -require 'uri' +require 'cgi' require 'net/http' module URI @@ -12,7 +12,7 @@ module URI def hostname # decode %XX from path to file v = host - URI.decode(v) + CGI.unescape(v) end # port is not allowed in URI -- cgit v1.2.3