8000 Fix encoding issue between Python 2 and 3 · samuelpiltch/codecov-python@bc28818 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 17, 2018. It is now read-only.

Commit bc28818

Browse files
committed
Fix encoding issue between Python 2 and 3
codecov#130
1 parent 1d77b8f commit bc28818

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

codecov/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,12 @@ def main(*argv, **kwargs):
719719
res = res.text.strip().split()
720720
result, upload_url = res[0], res[1]
721721

722+
# Handle reports encoding for Python 2 and 3
723+
if not isinstance(reports, bytes):
724+
reports = reports.encode('utf-8')
725+
722726
write(' Uploading to S3...')
723-
s3 = requests.put(upload_url, data=reports.encode('utf-8'),
727+
s3 = requests.put(upload_url, data=reports,
724728
headers={'Content-Type': 'text/plain',
725729
'x-amz-acl': 'public-read'})
726730
s3.raise_for_status()

0 commit comments

Comments
 (0)
0