diff --git a/osc/conf.py b/osc/conf.py index b1e3c3ab..bc6a6555 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -573,7 +573,13 @@ def _build_opener(apiurl): if not os.path.isfile(keyfile_path): return False with open(keyfile_path, "r") as f: - line = f.readline(100).strip() + try: + line = f.readline(100).strip() + except UnicodeDecodeError: + # skip binary files + return False + if line == "-----BEGIN RSA PRIVATE KEY-----": + return True if line == "-----BEGIN OPENSSH PRIVATE KEY-----": return True return False