fix crash with relative BORG_KEY_FILE, fixes #3197

This commit is contained in:
Thomas Waldmann 2017-10-20 21:13:11 +02:00
parent 38dd1f11ac
commit 7136e2c93c
1 changed files with 2 additions and 2 deletions

View File

@ -687,7 +687,7 @@ class KeyfileKey(ID_HMAC_SHA_256, KeyfileKeyBase):
id = self.repository.id
keyfile = os.environ.get('BORG_KEY_FILE')
if keyfile:
return self.sanity_check(keyfile, id)
return self.sanity_check(os.path.abspath(keyfile), id)
keys_dir = get_keys_dir()
for name in os.listdir(keys_dir):
filename = os.path.join(keys_dir, name)
@ -700,7 +700,7 @@ class KeyfileKey(ID_HMAC_SHA_256, KeyfileKeyBase):
def get_new_target(self, args):
keyfile = os.environ.get('BORG_KEY_FILE')
if keyfile:
return keyfile
return os.path.abspath(keyfile)
filename = args.location.to_key_filename()
path = filename
i = 1