py3: Fix application upload

Decode can safely be used here since the value contains only "text",
thus no need for an intent to encode specific characters
when passing 'data' dictionary further.

Story: 2006796
Task: 42748

Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I5709d6fec53422beae94521c48ba6303b16455a2
(cherry picked from commit 983e6f4e90)
This commit is contained in:
Charles Short 2021-07-02 04:12:25 -04:00 committed by Chuck Short
parent 1518543bf7
commit a47ac91bbc
1 changed files with 1 additions and 1 deletions

View File

@ -120,7 +120,7 @@ def do_application_upload(cc, args):
if not _is_url(data["tarfile"]):
try:
with open(data["tarfile"], 'rb') as tarfile:
binary_data = base64.urlsafe_b64encode(tarfile.read())
binary_data = base64.urlsafe_b64encode(tarfile.read()).decode("utf-8")
data.update({'binary_data': binary_data})
except Exception:
raise exc.CommandError("Error: Could not open file %s." % data["tarfile"])