Skip to content

Barcode starting with 0 not detected when EAN13 and UPC A are both enabled #457

Description

@jneuhaus20

I have a barcode starting with '0' that is either EAN13 or UPC A (honestly not sure which one it "really" is, just that it's ambiguous according to the readers.) When EAN13 and UPC_A are both enabled, no barcode is detected.

I tracked it down to the conversion functionality here:

if (ean13MayBeUPCA && canReturnUPCA) {
const rawBytes = result.getRawBytes();
// Transfer the metadata across
const resultUPCA: Result = new Result(
result.getText().substring(1),
rawBytes,
rawBytes.length,
result.getResultPoints(),
BarcodeFormat.UPC_A
);
resultUPCA.putAllMetadata(result.getResultMetadata());
return resultUPCA;
}

The problem is that UPCEANReader doesn't actually set the raw bytes, so rawBytes is set to null at line 98, and the accessor on 103 throws an error, which is caught higher up and converted into NotFoundException.

I tried to fork the demo's StackBlitz for this as the current one is out of date, but there's an unrelated ES5/ES6 issue going on across the packages.

I created PR #456 for this already.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions