From 269cf68d93d4665ae97aba601650c1f190029cfa Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Mon, 18 Nov 2024 18:43:33 +0100 Subject: [PATCH] Fix audb.available() for S3 / Minio backends (#464) --- audb/core/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/audb/core/api.py b/audb/core/api.py index 94b16176..3afc04db 100644 --- a/audb/core/api.py +++ b/audb/core/api.py @@ -81,9 +81,11 @@ def add_database(name: str, version: str, repository: Repository): # Avoid `ls(recursive=True)` for S3 and MinIO # as this is slow for large databases for obj in backend._client.list_objects(repository.name): - name = obj.object_name + name = obj.object_name[:-1] # remove "/" at end header_file = f"/{name}/{define.HEADER_FILE}" - for _obj in backend._client.list_objects(repository.name, name): + for _obj in backend._client.list_objects( + repository.name, f"{name}/" + ): version = _obj.object_name.split("/")[1] header_file = f"/{name}/{version}/{define.HEADER_FILE}" if version not in [