From ea72719a3312b39a43cab9bfa6ddc4f5336136d2 Mon Sep 17 00:00:00 2001 From: "Ed (ODSC)" Date: Tue, 19 Sep 2023 12:41:52 +0100 Subject: [PATCH] bodsdata.py: Fix issue with matching correct s3 folder in download_files_s3 --- bodsdata.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bodsdata.py b/bodsdata.py index a932349..aa02688 100644 --- a/bodsdata.py +++ b/bodsdata.py @@ -694,6 +694,8 @@ 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): items.append(item.key)