Skip to content

Commit

Permalink
fix: fix parse_ingredients function
Browse files Browse the repository at this point in the history
ingredients field is missing when no ingredient was detected
  • Loading branch information
raphael0202 committed Dec 18, 2023
1 parent f0ad1e1 commit 189c5cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion robotoff/off.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ def parse_ingredients(text: str, lang: str, timeout: int = 10) -> list[JSONType]
if response_data.get("status") != "success":
raise RuntimeError(f"Unable to parse ingredients: {response_data}")

return response_data["product"]["ingredients"]
return response_data["product"].get("ingredients", [])


def normalize_tag(value, lowercase=True):
Expand Down

0 comments on commit 189c5cc

Please sign in to comment.