diff options
author | Anatol Pomozov <anatol.pomozov@gmail.com> | 2020-05-29 08:37:42 +0300 |
---|---|---|
committer | Anatol Pomozov <anatol.pomozov@gmail.com> | 2020-06-02 18:35:44 +0300 |
commit | 9f35659c07e5c4cdbc4660292ea6b812e740f109 (patch) | |
tree | 1ce0c2da6f5819d73b7ffa1080ea73c2d7562292 | |
parent | dc1c9f3a501cb21820ebe2350de5aa687f59cf8a (diff) |
Fix warnings for upcoming ruby versionzj-fix-ruby-warnings
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 <anatol.pomozov@gmail.com>
-rw-r--r-- | ruby/gitlab-shell/lib/gitlab_net.rb | 2 | ||||
-rw-r--r-- | 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 |