From 674ea78815d8df4750b8c5c3b6d889ce9b1f3247 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Sun, 22 Nov 2020 17:36:17 +0100 Subject: [PATCH] Avoid a potential TypeError in util.ArFile.saveTo If no dir is passed to util.ArFile.saveTo, dir is set to os.getcwd(), which returns a str. Since self.name is a bytes, the subsequent os.path.join(dir, self.name) results in a TypeError. To fix this, use os.getcwdb(), which returns a bytes instead of a str. --- osc/util/ar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osc/util/ar.py b/osc/util/ar.py index 0a8522f2..6e5d2039 100644 --- a/osc/util/ar.py +++ b/osc/util/ar.py @@ -72,7 +72,7 @@ class ArFile(BytesIO): and permissions. """ if not dir: - dir = os.getcwd() + dir = os.getcwdb() fn = os.path.join(dir, self.name) with open(fn, 'wb') as f: f.write(self.getvalue())