From d803790c1aef9e2ef859b7fc08e45bcaea63e0af Mon Sep 17 00:00:00 2001 From: Fuxino Date: Wed, 14 Oct 2026 08:32:00 +0200 Subject: [PATCH] Fix mypy error for the SSH user in the sshpass command Check that ssh_user is set before quoting it. It always is in remote mode, but mypy can't know that. --- simple_backup/simple_backup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple_backup/simple_backup.py b/simple_backup/simple_backup.py index ebde737..ff28966 100755 --- a/simple_backup/simple_backup.py +++ b/simple_backup/simple_backup.py @@ -630,7 +630,7 @@ class Backup: # rsync splits the -e command itself, so quote the parts that may contain spaces if self.ssh_keyfile is not None: ssh = f'ssh -i {shlex.quote(self.ssh_keyfile)} -o StrictHostKeyChecking=accept-new' - elif self._password_auth and which('sshpass'): + elif self._password_auth and self.ssh_user is not None and which('sshpass'): ssh = f'sshpass -e ssh -l {shlex.quote(self.ssh_user)} -o StrictHostKeyChecking=accept-new' else: ssh = 'ssh -o StrictHostKeyChecking=accept-new'