From 4269426b28a4d930b0c3b5fa2c69d3fce68560b2 Mon Sep 17 00:00:00 2001 From: lethliel Date: Thu, 13 Dec 2018 14:32:38 +0100 Subject: [PATCH] [python3] msg and body are byte strings --- osc/babysitter.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osc/babysitter.py b/osc/babysitter.py index 4b2583ae..6ca92531 100644 --- a/osc/babysitter.py +++ b/osc/babysitter.py @@ -16,6 +16,7 @@ from .oscsslexcp import NoSecureSSLError from osc.util.cpio import CpioError from osc.util.packagequery import PackageError +from osc.util.helper import decode_it try: from M2Crypto.SSL.Checker import SSLVerificationError @@ -112,11 +113,11 @@ def run(prg, argv=None): print(body, file=sys.stderr) if e.code in [400, 403, 404, 500]: - if '' in body: - msg = body.split('')[1] - msg = msg.split('')[0] - msg = msg.replace('<', '<').replace('>' , '>').replace('&', '&') - print(msg, file=sys.stderr) + if b'' in body: + msg = body.split(b'')[1] + msg = msg.split(b'')[0] + msg = msg.replace(b'<', b'<').replace(b'>' , b'>').replace(b'&', b'&') + print(decode_it(msg), file=sys.stderr) if e.code >= 500 and e.code <= 599: print('\nRequest: %s' % e.filename) print('Headers:')