mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-19 16:49:34 +00:00
handle momentarily bad reads from qrcode library
This commit is contained in:
parent
4eb96b0367
commit
03d1fc55ce
1 changed files with 7 additions and 4 deletions
|
|
@ -295,9 +295,6 @@ class ScanController extends AbstractController
|
||||||
return array_reverse($items);
|
return array_reverse($items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[Route(path: '/augmented', name: 'scan_augmented', methods: ['POST'])]
|
#[Route(path: '/augmented', name: 'scan_augmented', methods: ['POST'])]
|
||||||
public function augmented(Request $request): Response
|
public function augmented(Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
@ -317,7 +314,13 @@ class ScanController extends AbstractController
|
||||||
$modeEnum = BarcodeSourceType::from((int) $mode);
|
$modeEnum = BarcodeSourceType::from((int) $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scan = $this->barcodeNormalizer->scanBarcodeContent($input, $modeEnum);
|
try {
|
||||||
|
$scan = $this->barcodeNormalizer->scanBarcodeContent($input, $modeEnum);
|
||||||
|
} catch (InvalidArgumentException) {
|
||||||
|
// When the camera/barcode reader momentarily misreads a barcode whilst scanning
|
||||||
|
// return and empty result, so the good read data still remains visible
|
||||||
|
return new Response('', 200);
|
||||||
|
}
|
||||||
$decoded = $scan->getDecodedForInfoMode();
|
$decoded = $scan->getDecodedForInfoMode();
|
||||||
|
|
||||||
$locale = $request->getLocale();
|
$locale = $request->getLocale();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue