1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 01:06:50 +00:00

Emit user-friendly error if repo key is exported to a directory (fixes #4348)

This commit is contained in:
Milkey Mouse 2019-02-19 23:56:20 -08:00
parent ce69fc1e19
commit 72ebd13e6f
No known key found for this signature in database
GPG key ID: C6EF5A02F5647987

View file

@ -325,10 +325,14 @@ def do_key_export(self, args, repository):
if not args.path:
self.print_error("output file to export key to expected")
return EXIT_ERROR
if args.qr:
manager.export_qr(args.path)
else:
manager.export(args.path)
try:
if args.qr:
manager.export_qr(args.path)
else:
manager.export(args.path)
except IsADirectoryError:
self.print_error("'{}' must be a file, not a directory".format(args.path))
return EXIT_ERROR
return EXIT_SUCCESS
@with_repository(lock=False, exclusive=False, manifest=False, cache=False)