mirror of
https://github.com/grocy/grocy.git
synced 2026-03-27 23:29:25 +01:00
fix: confirm grocycode is of PRODUCT type in GetProductIdFromBarcode (#1581)
* fix: confirm grocycode is of PRODUCT type in GetProductIdFromBarcode * Fixed formatting * Don't output the given input (for security reasons) Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
parent
d23f730a0b
commit
95cb9ffb90
|
|
@ -697,6 +697,10 @@ class StockService extends BaseService
|
|||
if (Grocycode::Validate($barcode))
|
||||
{
|
||||
$gc = new Grocycode($barcode);
|
||||
if ($gc->GetType() != Grocycode::PRODUCT)
|
||||
{
|
||||
throw new \Exception('Invalid grocycode');
|
||||
}
|
||||
return intval($gc->GetId());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user