From 327c23d07255c81b2e465868924f56be34aeaf48 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Oct 10 2019 10:39:17 +0000 Subject: Use bytes for debug string Fixes: https://pagure.io/koji/issue/1656 --- diff --git a/koji/__init__.py b/koji/__init__.py index db1ed2e..2e9399d 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -2545,8 +2545,12 @@ class ClientSession(object): self.logger.debug("url: %s" % handler) for _key in callopts: _val = callopts[_key] - if _key == 'data' and len(_val) > 1024: - _val = _val[:1024] + '...' + if _key == 'data': + if six.PY3 and isinstance(_val, bytes): + # convert to hex-string + _val = '0x' + _val.hex() + if len(_val) > 1024: + _val = _val[:1024] + '...' self.logger.debug("%s: %r" % (_key, _val)) with warnings.catch_warnings(): warnings.simplefilter("ignore")