From 1ac59f987792f4763ad7323b0f3c59f871672538 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 1 Jan 2021 05:04:54 +0100 Subject: [PATCH] More encode/decode fixes --- src/yunohost/backup.py | 4 ++-- src/yunohost/certificate.py | 2 +- src/yunohost/diagnosis.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index dfed5cac1..a22c33f15 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -177,11 +177,11 @@ class BackupRestoreTargetsManager(object): or (exclude and isinstance(exclude, list) and not include) if include: - return [target.encode("Utf-8") for target in self.targets[category] + return [target for target in self.targets[category] if self.results[category][target] in include] if exclude: - return [target.encode("Utf-8") for target in self.targets[category] + return [target for target in self.targets[category] if self.results[category][target] not in exclude] diff --git a/src/yunohost/certificate.py b/src/yunohost/certificate.py index fc81ae0a6..421303615 100644 --- a/src/yunohost/certificate.py +++ b/src/yunohost/certificate.py @@ -638,7 +638,7 @@ def _get_status(domain): cert_subject = cert.get_subject().CN cert_issuer = cert.get_issuer().CN organization_name = cert.get_issuer().O - valid_up_to = datetime.strptime(cert.get_notAfter(), "%Y%m%d%H%M%SZ") + valid_up_to = datetime.strptime(cert.get_notAfter().decode('utf-8'), "%Y%m%d%H%M%SZ") days_remaining = (valid_up_to - datetime.utcnow()).days if cert_issuer == _name_self_CA(): diff --git a/src/yunohost/diagnosis.py b/src/yunohost/diagnosis.py index e4dd84f6d..93ece21fc 100644 --- a/src/yunohost/diagnosis.py +++ b/src/yunohost/diagnosis.py @@ -451,7 +451,7 @@ class Diagnoser(): key = "diagnosis_description_" + id_ descr = m18n.n(key) # If no description available, fallback to id - return descr if descr.decode('utf-8') != key else id_ + return descr if descr != key else id_ @staticmethod def i18n(report, force_remove_html_tags=False):