Skip to content

Commit

Permalink
fix: fix KeyError exception in UPCImageImporter
Browse files Browse the repository at this point in the history
some products have an empty "images.nutrition" dict
we check here that imgid key exists in the image data

fixes #1442
  • Loading branch information
raphael0202 committed Oct 25, 2024
1 parent e8eed45 commit c6ccedf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion robotoff/insights/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ def generate_candidates(
image_data["imgid"]
for key, image_data in product.images.items()
# only look for non-raw images here (=selected images)
if not key.isdigit()
if not key.isdigit() and "imgid" in image_data
):
# We check that at least one selected image has the image
# ID as reference before creating the insight
Expand Down

0 comments on commit c6ccedf

Please sign in to comment.