You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2018/03/27 04:11:18 UTC
buildr git commit: Ensure that the username and passwords declared
for repositories are correctly url encoded for the upload repositories when
converted to a URL. (i.e. Ensure `Buildr.repositories.release_to` and
`Buildr.repositories.snapshot_to` setting
Repository: buildr
Updated Branches:
refs/heads/master eb26314e0 -> 9531ba52d
Ensure that the username and passwords declared for repositories are correctly url encoded for
the upload repositories when converted to a URL. (i.e. Ensure `Buildr.repositories.release_to`
and `Buildr.repositories.snapshot_to` settings can have usernames and passwords with special
characters).
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/9531ba52
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/9531ba52
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/9531ba52
Branch: refs/heads/master
Commit: 9531ba52d098fe4bf87804a238af69ffd24d80bc
Parents: eb26314
Author: Peter Donald <pe...@realityforge.org>
Authored: Tue Mar 27 15:11:11 2018 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Tue Mar 27 15:11:11 2018 +1100
----------------------------------------------------------------------
CHANGELOG | 4 ++++
lib/buildr/core/transports.rb | 2 +-
lib/buildr/packaging/artifact.rb | 5 +++--
3 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/9531ba52/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 79de5bc..99f48b1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,8 @@
1.5.6 (Pending)
+* Fixed: Ensure that the username and passwords declared for repositories are correctly url encoded for
+ the upload repositories when converted to a URL. (i.e. Ensure `Buildr.repositories.release_to`
+ and `Buildr.repositories.snapshot_to` settings can have usernames and passwords with special
+ characters).
* Added: Add support for allowing some dependencies to include transitive dependencies via the
`pom.include_transitive_dependencies` configuration setting.
* Added: Add support for adding dependencies to the pom via the `pom.additional_dependencies` configuration
http://git-wip-us.apache.org/repos/asf/buildr/blob/9531ba52/lib/buildr/core/transports.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/core/transports.rb b/lib/buildr/core/transports.rb
index 6898fbd..f41bd4d 100644
--- a/lib/buildr/core/transports.rb
+++ b/lib/buildr/core/transports.rb
@@ -278,7 +278,7 @@ module URI
headers['Cache-Control'] = 'no-cache'
headers['User-Agent'] = "Buildr-#{Buildr::VERSION}"
request = Net::HTTP::Get.new(request_uri.empty? ? '/' : request_uri, headers)
- request.basic_auth self.user, self.password if self.user
+ request.basic_auth URI.decode(self.user), URI.decode(self.password) if self.user
http.verify_mode = ::OpenSSL::SSL.const_get(ENV['SSL_VERIFY_MODE']) if ENV['SSL_VERIFY_MODE']
http.ca_path = ENV['SSL_CA_CERTS'] if ENV['SSL_CA_CERTS']
http.request request do |response|
http://git-wip-us.apache.org/repos/asf/buildr/blob/9531ba52/lib/buildr/packaging/artifact.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/packaging/artifact.rb b/lib/buildr/packaging/artifact.rb
index 010a8df..2af68c7 100644
--- a/lib/buildr/packaging/artifact.rb
+++ b/lib/buildr/packaging/artifact.rb
@@ -231,8 +231,9 @@ module Buildr #:nodoc:
# Username/password may be part of URI, or separate entities.
uri = URI.parse(upload_to[:url].clone)
uri.path = uri.path + '/' unless uri.path[-1] == '/'
- uri.user = upload_to[:username] if upload_to[:username]
- uri.password = upload_to[:password] if upload_to[:password]
+ to_escape = "!\"\#$%&'()*+,-./:;<=>?@{}|~`'"
+ uri.user = URI.encode(upload_to[:username], to_escape) if upload_to[:username]
+ uri.password = URI.encode(upload_to[:password], to_escape) if upload_to[:password]
path = group.gsub('.', '/') + "/#{id}/#{version}/#{upload_name}"