Fixed OFF barcode lookup plugin API URL (fixes #2653)

This commit is contained in:
Bernd Bestel
2025-01-27 09:12:14 +01:00
parent e3d0ddbce6
commit d747a6c86a
2 changed files with 58 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ class OpenFoodFactsBarcodeLookupPlugin extends BaseBarcodeLookupPlugin
protected function ExecuteLookup($barcode)
{
$webClient = new Client(['http_errors' => false]);
$response = $webClient->request('GET', 'https://world.openfoodfacts.net/api/v2/product/' . preg_replace('/[^0-9]/', '', $barcode) . '?fields=product_name,image_url', ['headers' => ['User-Agent' => 'GrocyOpenFoodFactsBarcodeLookupPlugin/1.0 (https://grocy.info)']]);
$response = $webClient->request('GET', 'https://world.openfoodfacts.org/api/v2/product/' . preg_replace('/[^0-9]/', '', $barcode) . '?fields=product_name,image_url', ['headers' => ['User-Agent' => 'GrocyOpenFoodFactsBarcodeLookupPlugin/1.0 (https://grocy.info)']]);
$statusCode = $response->getStatusCode();
// Guzzle throws exceptions for connection errors, so nothing to do on that here