diff --git a/robotoff/off.py b/robotoff/off.py index eded9dd3b0..efbb47b89f 100644 --- a/robotoff/off.py +++ b/robotoff/off.py @@ -119,9 +119,8 @@ def generate_json_ocr_url(product_id: ProductIdentifier, image_id: str) -> str: :param image_id: the image ID (ex: `1`, `2`,...) :return: the generated image URL """ - return ( - settings.BaseURLProvider.static(product_id.server_type) - + f"/images/products{generate_json_ocr_path(product_id, image_id)}" + return settings.BaseURLProvider.image_url( + product_id.server_type, generate_json_ocr_path(product_id, image_id) ) diff --git a/tests/integration/test_api.py b/tests/integration/test_api.py index 5f3afd264c..62becc174e 100644 --- a/tests/integration/test_api.py +++ b/tests/integration/test_api.py @@ -76,7 +76,7 @@ def test_random_question(client, mocker): "insight_id": insight_id, "insight_type": "category", "server_type": "off", - "source_image_url": "https://images.openfoodfacts.net/images/products/1/ingredients_fr.51.400.jpg", + "source_image_url": "https://images.openfoodfacts.net/images/products/000/000/000/0001/ingredients_fr.51.400.jpg", } ], "status": "found", diff --git a/tests/unit/insights/test_question.py b/tests/unit/insights/test_question.py index 870e81f46e..65c6b37f88 100644 --- a/tests/unit/insights/test_question.py +++ b/tests/unit/insights/test_question.py @@ -169,7 +169,7 @@ def test_category_question_formatter( "insight_id": str(insight.id), "insight_type": InsightType.category.name, "server_type": ServerType.off.name, - "source_image_url": "https://images.openfoodfacts.net/images/products/111/111/111/1/front_fr.10.400.jpg", + "source_image_url": "https://images.openfoodfacts.net/images/products/000/111/111/1111/front_fr.10.400.jpg", } @@ -221,7 +221,7 @@ def test_label_question_formatter( "insight_id": str(insight.id), "insight_type": InsightType.label.name, "server_type": ServerType.off.name, - "source_image_url": "https://images.openfoodfacts.net/images/products/111/111/111/1/1.400.jpg", + "source_image_url": "https://images.openfoodfacts.net/images/products/000/111/111/1111/1.400.jpg", } if ref_image_url is not None: