From 2d55b903118bb79db385381e2905159d8a63b53d Mon Sep 17 00:00:00 2001 From: swdee Date: Wed, 18 Feb 2026 21:53:54 +1300 Subject: [PATCH] fix @MayNiklas reported bug: when manually submitting the form (from a barcode scan or manual input) redirect to Create New part screen for the decoded information instead of showing 'Format Unknown' popup error message --- src/Controller/ScanController.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Controller/ScanController.php b/src/Controller/ScanController.php index 537be473..5cbdb6a5 100644 --- a/src/Controller/ScanController.php +++ b/src/Controller/ScanController.php @@ -100,8 +100,19 @@ class ScanController extends AbstractController // If not in info mode, mimic “normal scan” behavior: redirect if possible. if (!$infoMode) { - $url = $this->barcodeParser->getRedirectURL($scan); - return $this->redirect($url); + try { + $url = $this->barcodeParser->getRedirectURL($scan); + return $this->redirect($url); + } catch (EntityNotFoundException) { + // Decoded OK, but no part is found. If it’s a vendor code, redirect to create. + $createUrl = $this->buildCreateUrlForScanResult($scan, $request->getLocale()); + if ($createUrl !== null) { + return $this->redirect($createUrl); + } + + // Otherwise: show “not found” (not “format unknown”) + $this->addFlash('warning', 'scan.qr_not_found'); + } } // Info mode fallback: render page with prefilled result