1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-26 14:46:14 +01:00

[python3] msg and body are byte strings

This commit is contained in:
lethliel 2018-12-13 14:32:38 +01:00
parent 7bd9ca485d
commit 4269426b28

View File

@ -16,6 +16,7 @@ from osc import oscerr
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 '<summary>' in body:
msg = body.split('<summary>')[1]
msg = msg.split('</summary>')[0]
msg = msg.replace('&lt;', '<').replace('&gt;' , '>').replace('&amp;', '&')
print(msg, file=sys.stderr)
if b'<summary>' in body:
msg = body.split(b'<summary>')[1]
msg = msg.split(b'</summary>')[0]
msg = msg.replace(b'&lt;', b'<').replace(b'&gt;' , b'>').replace(b'&amp;', b'&')
print(decode_it(msg), file=sys.stderr)
if e.code >= 500 and e.code <= 599:
print('\nRequest: %s' % e.filename)
print('Headers:')