mirror of
https://github.com/grocy/grocy.git
synced 2026-03-27 23:29:25 +01:00
Handle image URLs with query parameters returned from an external barcode lookup plugin
This commit is contained in:
parent
46253c455f
commit
2a3e23ded4
|
|
@ -13,6 +13,7 @@
|
|||
- Optimizations in the built-in Open Food Facts external barcode lookup plugin:
|
||||
- A provided but empty localized product name is now ignored
|
||||
- Non-ASCII characters in product names are now ignored (e.g. line breaks caused problems)
|
||||
- Optimized that when an external barcode lookup plugin returned an image URL with query parameters, an invalid picture (file name) was added to the created product
|
||||
|
||||
### Shopping list
|
||||
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ class StockService extends BaseService
|
|||
{
|
||||
$webClient = new Client();
|
||||
$response = $webClient->request('GET', $pluginOutput['__image_url'], ['headers' => ['User-Agent' => 'Grocy/' . $this->getApplicationService()->GetInstalledVersion()->Version . ' (https://grocy.info)']]);
|
||||
$fileName = $pluginOutput['__barcode'] . '.' . pathinfo($pluginOutput['__image_url'], PATHINFO_EXTENSION);
|
||||
$fileName = $pluginOutput['__barcode'] . '.' . pathinfo(parse_url($pluginOutput['__image_url'], PHP_URL_PATH), PATHINFO_EXTENSION);
|
||||
file_put_contents($this->getFilesService()->GetFilePath('productpictures', $fileName), $response->getBody());
|
||||
$productData['picture_file_name'] = $fileName;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user