We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb8e8e8 commit bcadb2aCopy full SHA for bcadb2a
lambdas/list/handler.py
@@ -30,6 +30,10 @@ def handler(event, context):
30
images_bucket = get_bucket_name_images()
31
images = s3.list_objects(Bucket=images_bucket)
32
33
+ if not images.get("Contents"):
34
+ print(f"Bucket {images_bucket} is empty")
35
+ return []
36
+
37
result = {}
38
# collect the original images
39
for obj in images["Contents"]:
@@ -49,7 +53,7 @@ def handler(event, context):
49
53
# collect the associated resized images
50
54
resized_bucket = get_bucket_name_resized()
51
55
images = s3.list_objects(Bucket=resized_bucket)
52
- for obj in images["Contents"]:
56
+ for obj in images.get("Contents", []):
57
if obj["Key"] not in result:
58
continue
59
result[obj["Key"]]["Resized"] = {
0 commit comments