mirror of
				https://github.com/grocy/grocy.git
				synced 2025-10-31 10:46:36 +00: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:
		| @@ -697,6 +697,10 @@ class StockService extends BaseService | |||||||
| 		if (Grocycode::Validate($barcode)) | 		if (Grocycode::Validate($barcode)) | ||||||
| 		{ | 		{ | ||||||
| 			$gc = new Grocycode($barcode); | 			$gc = new Grocycode($barcode); | ||||||
|  | 			if ($gc->GetType() != Grocycode::PRODUCT) | ||||||
|  | 			{ | ||||||
|  | 				throw new \Exception('Invalid grocycode'); | ||||||
|  | 			} | ||||||
| 			return intval($gc->GetId()); | 			return intval($gc->GetId()); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user