Skip to content

Commit

Permalink
bodsdata.py: Fix issue with matching correct s3 folder in download_fi…
Browse files Browse the repository at this point in the history
…les_s3
  • Loading branch information
Ed (ODSC) committed Sep 19, 2023
1 parent 1df1c59 commit 87fe5c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bodsdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,10 @@ def download_files_s3(source, s3_path_pattern, latest=False, bucket="bodsdata-oo
bucket = get_s3_bucket(bucket)
items = []

if not s3_path_pattern.startswith("^"): s3_path_pattern = f"^{s3_path_pattern}"

for item in bucket.objects.all():
if re.search(s3_path_pattern, item.key):
if item.key.startswith(s3_path_pattern):
items.append(item.key)

items.sort()
Expand Down

0 comments on commit 87fe5c1

Please sign in to comment.