From 46c3eee9a47ce7d0edb893f875d80eda77f94b8e Mon Sep 17 00:00:00 2001 From: samuel-w Date: Wed, 24 Feb 2021 07:25:17 -0600 Subject: [PATCH] Improve kwallet verification. By @samuel-w (#889) --- src/vorta/keyring/kwallet.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vorta/keyring/kwallet.py b/src/vorta/keyring/kwallet.py index d84518dc..3ffded74 100644 --- a/src/vorta/keyring/kwallet.py +++ b/src/vorta/keyring/kwallet.py @@ -20,7 +20,7 @@ class VortaKWallet5Keyring(VortaKeyring): self.object_path, self.interface_name, QtDBus.QDBusConnection.sessionBus()) - if not (self.iface.isValid() and self.get_result("isEnabled")): + if not (self.iface.isValid() and self.get_result("isEnabled") is True): raise KWalletNotAvailableException def set_password(self, service, repo_url, password): @@ -49,7 +49,10 @@ class VortaKWallet5Keyring(VortaKeyring): wId = QVariant(0) wId.convert(4) output = self.get_result("open", args=[wallet_name, wId, 'vorta-repo']) - self.handle = int(output) + try: + self.handle = int(output) + except ValueError: # For when kwallet is disabled or dbus otherwise broken + return -2 class KWalletNotAvailableException(Exception):