Skip to content

Commit

Permalink
Fix audb.available() for S3 / Minio backends (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw authored Nov 18, 2024
1 parent c2f085f commit 269cf68
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions audb/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down

0 comments on commit 269cf68

Please sign in to comment.