Skip to content

Commit

Permalink
minor code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
shokakucarrier committed Sep 1, 2023
1 parent c9d82e2 commit 4a6c01b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions charon/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,15 +700,14 @@ def list_folder_content(self, bucket_name: str, folder: str) -> List[str]:
bucket = self.__get_bucket(bucket_name)

try:
paginator = bucket.meta.client.get_paginator('list_objects_v2')
if not folder or folder.strip() == "/" or folder.strip() == "":
paginator = bucket.meta.client.get_paginator('list_objects_v2')
pages = paginator.paginate(
Bucket=bucket.name,
Delimiter='/'
)
else:
prefix = folder if folder.endswith("/") else folder+"/"
paginator = bucket.meta.client.get_paginator('list_objects_v2')
pages = paginator.paginate(
Bucket=bucket.name,
Prefix=prefix,
Expand Down

0 comments on commit 4a6c01b

Please sign in to comment.