metafloor / bwip-js

Barcode Writer in Pure JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gs1qrcode broken since 3.2.1 (and still in 3.3.0)

Mertsch opened this issue · comments

3.2.0 generates a comparable output https://the-burtons.xyz/barcode-generator/
and 3.2.1 - 3.3.0 generate something different, that looks valid on first sight, but can't be scanned.

I tried to find a difference in the source code, as the commits aren't that many, but failed to find anything.

Are you planning to provide an example that shows the error? That is the usual way to report an issue....

I am sorry, I thought mentioning the type of code is enough. So
Code: GS1 QR Code
Data: (01)03453120000011(8200)http://www.abc.net(10)ABCD1234(410)9501101020917

https://bwip-js.metafloor.com/demo/demo.html (I assume 3.3.0) generates
bwipjs-api metafloor

While https://the-burtons.xyz/barcode-generator/ and 3.0.5, 3.1.0, 3.2.0 generate
Correct

Trying to scan either with an iPhone results in abc.net for 3.2.0 and nothing for 3.2.1+

I was not able to reproduce your results using the current versions of bwip-js and the BWIPP online generator. My tests show the same image generated by both. Additionally, the Android zxing scanner and a Symbol camera-based hand scanner both recognize the barcodes and return the expected result.

The test framework for bwip-js compares against a known good image generated by BWIPP and ghostscript, and there have been no changes detected. Since you supplied the example text used by BWIPP (which is also a test case for bwip-js), I don't think there have been any changes in rendering between versions.

I am on holiday starting today and will be back on April 3. We can take up this discussion then.

@metafloor Enjoy your holiday, this is low prio!
I was really confused when you said you are not getting the same result with (01)03453120000011(8200)http://www.abc.net(10)ABCD1234(410)9501101020917 and https://bwip-js.metafloor.com/demo/demo.html ...
Now here comes the crazy part. I am getting the correct result, too but only once. I refresh the page, enter (01)03453120000011(8200)http://www.abc.net(10)ABCD1234(410)9501101020917 hit enter, get the correct one, hit enter again and consistently get the same different one.

Found the bug in the translation of BWIPP's context logic - which creates static-initialized state for each encoder. That is why it worked the first time, and then didn't on subsequent renders.

The fix is available in either 3.3.1 or 3.3.2 depending on source being either github or npmjs. (My deployment stack is having issues with npmjs right now - but I have verified that 3.3.1 is available on that platform.)