From 03e258e738504ebb4a50be6b7d59876a49b8ac46 Mon Sep 17 00:00:00 2001 From: barrybingo Date: Sun, 13 Dec 2020 11:13:54 +0000 Subject: [PATCH] Throw appropriate error if any B2 option contains a forward slash character --- management/backup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/management/backup.py b/management/backup.py index 0a8a021e..e8c04626 100755 --- a/management/backup.py +++ b/management/backup.py @@ -457,6 +457,13 @@ def list_target_files(config): return [(key.name[len(path):], key.size) for key in bucket.list(prefix=path)] elif target.scheme == 'b2': + # InvalidBackendURL error for B2 backend if application key contains a '/' character + # See: https://bugs.launchpad.net/duplicity/+bug/1819390 + # With a slash anywhere after b2::// the above urlparse will put something into target.path, thus + if not "".__eq__(target.path): + raise ValueError("""No B2 configuration option can contain '/' the foward slash character. + Please create a new API key or Bucket that does not contain any forward slashes""") + from b2sdk.v1 import InMemoryAccountInfo, B2Api from b2sdk.v1.exception import NonExistentBucket info = InMemoryAccountInfo()