From 3342f88f3beaa4238cab6ea9ac814a7506f837bf Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Sat, 19 Sep 2020 11:19:17 +0200 Subject: [PATCH] builder: properly decode the http response body What is returned by content.decode() is a binary string and needs to be properly decoded before we use it, especially in the error messages. --- plugins/builder/osbuild.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/builder/osbuild.py b/plugins/builder/osbuild.py index 871d352..2f6b56d 100644 --- a/plugins/builder/osbuild.py +++ b/plugins/builder/osbuild.py @@ -178,7 +178,7 @@ class Client: res = self.http.post(url, json=cro.as_dict()) if res.status_code != 201: - body = res.content.strip() + body = res.content.decode("utf-8").strip() msg = f"Failed to create the compose request: {body}" raise koji.GenericError(msg) from None @@ -192,7 +192,7 @@ class Client: res = self.http.get(url) if res.status_code != 200: - body = res.content.strip() + body = res.content.decode("utf-8").strip() msg = f"Failed to get the compose status: {body}" raise koji.GenericError(msg) from None