Skip to content

Commit

Permalink
Cherry pick base64 encoding changes to 1.17 (#9)
Browse files Browse the repository at this point in the history
* fix(bintray): Use the right base64 encoding method (#5)

* fix(bintray): Apply same b64 fix to other instances. (#6)
  • Loading branch information
Travis Tomsu authored Feb 13, 2020
1 parent 952b24f commit 63b5835
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions dev/buildtool/gradle_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ def __add_bintray_auth_header(self, request):
"""Adds bintray authentication header to the request."""
user = os.environ['BINTRAY_USER']
password = os.environ['BINTRAY_KEY']
encoded_auth = base64.encodestring(str.encode('{user}:{password}'.format(
user=user, password=password)))[:-1] # strip eoln
encoded_auth = base64.b64encode('{user}:{password}'.format(user=user, password=password))
request.add_header('Authorization', 'Basic ' + bytes.decode(encoded_auth))

def bintray_repo_has_version(self, repo, package_name, repository,
Expand Down
4 changes: 2 additions & 2 deletions dev/buildtool/inspection_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def __init__(self, factory, options, **kwargs):
password = os.environ.get('BINTRAY_KEY')
if user and password:
user_password = '{user}:{password}'.format(user=user, password=password)
encoded_auth = base64.encodestring(user_password.encode())[:-1] # no eoln
encoded_auth = base64.b64encode(user_password)
self.__basic_auth = 'Basic %s' % encoded_auth.decode()
else:
self.__basic_auth = None
Expand Down Expand Up @@ -1120,7 +1120,7 @@ def filter_from_candidates(newest_version, candidate_version_list):
unused_list = unused_map.get('spinnaker-monitoring', [])
if unused_list:
name = 'spinnaker-monitoring'

newest_version = self.most_recent_version(name, unused_list)
candidates = filter_from_candidates(newest_version, unused_list)

Expand Down

0 comments on commit 63b5835

Please sign in to comment.