Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

ProductBarcode: backend: properly define max length of a barcode

Crumb Owl6d516f6de650
diff --git a/backend/app/api/handlers/v1/v1_ctrl_product_search.go b/backend/app/api/handlers/v1/v1_ctrl_product_search.go
index 832def4d..ce21b022 100644
--- a/backend/app/api/handlers/v1/v1_ctrl_product_search.go
+++ b/backend/app/api/handlers/v1/v1_ctrl_product_search.go
@@ -102,8 +102,8 @@ type BARCODESPIDER_COMResponse struct {
// @Security Bearer
func (ctrl *V1Controller) HandleProductSearchFromBarcode(conf config.BarcodeAPIConf) errchain.HandlerFunc {
type query struct {
- // 4,296 characters is the maximum length of a QR code
- EAN string `schema:"productEAN" validate:"required,max=4296"`
+ // 80 characters is the longest non-2D barcode length (GS1-128)
+ EAN string `schema:"productEAN" validate:"required,max=80"`
}
return func(w http.ResponseWriter, r *http.Request) error {