Skip to content

Commit

Permalink
fix: object-storage: should not list backups recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
sloonz committed Nov 25, 2023
1 parent 01f0c52 commit 6bac526
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion destinations/object-storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 4 additions & 0 deletions tests/dest_object_storage_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()))

0 comments on commit 6bac526

Please sign in to comment.