From a7b64727f568c716cbbc9609cfca69b15a23d722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bournhonesque?= Date: Fri, 11 Aug 2023 11:34:15 +0200 Subject: [PATCH] fix: barcode should not be an empty str in webhook call Fixes https://openfoodfacts.sentry.io/issues/4342694438 --- robotoff/app/api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/robotoff/app/api.py b/robotoff/app/api.py index 465e5c33d1..276c107a3f 100644 --- a/robotoff/app/api.py +++ b/robotoff/app/api.py @@ -1193,6 +1193,11 @@ def on_post(self, req: falcon.Request, resp: falcon.Response): title="invalid_action", description="action must be one of " "`deleted`, `updated`", ) + if not barcode: + raise falcon.HTTPBadRequest( + title="invalid_barcode", + description="barcode should not be empty", + ) server_type = ServerType.get_from_server_domain(server_domain) product_id = ProductIdentifier(barcode, server_type)