Skip to content

Commit 84c882a

Browse files
authored
Fix DAG bundle retrieval from S3 (apache#57178)
Signed-off-by: Manabu McCloskey <manabu.mccloskey@gmail.com>
1 parent 970d7da commit 84c882a

File tree

2 files changed

+3
-0
lines changed
  • providers/amazon
    • src/airflow/providers/amazon/aws/hooks
    • tests/unit/amazon/aws/hooks

2 files changed

+3
-0
lines changed

providers/amazon/src/airflow/providers/amazon/aws/hooks/s3.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,8 @@ def sync_to_local_dir(self, bucket_name: str, local_dir: Path, s3_prefix="", del
17741774
local_s3_objects = []
17751775
s3_bucket = self.get_bucket(bucket_name)
17761776
for obj in s3_bucket.objects.filter(Prefix=s3_prefix):
1777+
if obj.key.endswith("/"):
1778+
continue
17771779
obj_path = Path(obj.key)
17781780
local_target_path = local_dir.joinpath(obj_path.relative_to(s3_prefix))
17791781
if not local_target_path.parent.exists():

providers/amazon/tests/unit/amazon/aws/hooks/test_s3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,7 @@ def get_logs_string(call_args_list):
18001800

18011801
s3_client.put_object(Bucket=s3_bucket, Key="dag_01.py", Body=b"test data")
18021802
s3_client.put_object(Bucket=s3_bucket, Key="dag_02.py", Body=b"test data")
1803+
s3_client.put_object(Bucket=s3_bucket, Key="subproject1/", Body=b"")
18031804
s3_client.put_object(Bucket=s3_bucket, Key="subproject1/dag_a.py", Body=b"test data")
18041805
s3_client.put_object(Bucket=s3_bucket, Key="subproject1/dag_b.py", Body=b"test data")
18051806

0 commit comments

Comments
 (0)