From 6bac5266d6d26a970eb4ad9646a91895524a2561 Mon Sep 17 00:00:00 2001 From: Simon Lipp Date: Sat, 25 Nov 2023 17:15:41 +0100 Subject: [PATCH] fix: object-storage: should not list backups recursively --- destinations/object-storage.go | 2 +- tests/dest_object_storage_tests.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/destinations/object-storage.go b/destinations/object-storage.go index f9d2f98..3ca331b 100644 --- a/destinations/object-storage.go +++ b/destinations/object-storage.go @@ -91,7 +91,7 @@ func (d *objectStorageDestination) ListBackups() ([]uback.Backup, error) { ctx, cancel := context.WithCancel(context.Background()) objectsCh := d.client.ListObjects(ctx, d.bucket, minio.ListObjectsOptions{ Prefix: d.prefix, - Recursive: true, + Recursive: false, }) defer cancel() diff --git a/tests/dest_object_storage_tests.py b/tests/dest_object_storage_tests.py index 9769f5a..3420d2a 100644 --- a/tests/dest_object_storage_tests.py +++ b/tests/dest_object_storage_tests.py @@ -49,3 +49,7 @@ def test_os_destination(self): subprocess.check_call([uback, "restore", "-d", f"{d}/restore", dest]) self.assertEqual(b"hello", read_file(glob.glob(f"{d}/restore/*/a")[0])) self.assertEqual(b"world", read_file(glob.glob(f"{d}/restore/*/b")[0])) + + # Searching on "/" should not yield any result in the "/test/" prefix + parent_dest = f"id=test,type=object-storage,@retention-policy=daily=3,key-file={d}/backup.key,url=http://minioadmin:minioadmin@localhost:9000/testbucket" + self.assertEqual(0, len(subprocess.check_output([uback, "list", "backups", parent_dest]).splitlines()))