mirror of
https://github.com/grocy/grocy.git
synced 2026-04-03 11:26:16 +02:00
FIX: Issue with __image_url when it contains HTTP params (ie, ?<params>)
This commit make sure Grocy only uses the base URL when creating the filename for the product image from the __image_url. When the __image_url contains HTTP parms it will split the URL on the '?' character and only use the 1st part.
This commit is contained in:
parent
63dcfcde47
commit
95a8a4a24d
|
|
@ -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(explode('?', $pluginOutput['__image_url'])[0], 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