Closed AndreasGassmann closed 2 years ago
Hi, Thanks for your report. But I could not reproduce it..
Yes, under normal circumstances it works without any issues. It is only when used in this specific project that the resulting QR codes are wrong.
I was hoping you could give me some pointers about how I could go about debugging this. Because the code from this library that I call is very minimal, so somehow the internal state / logic of this module is affected by something in that project that breaks it. The pattern that is generated, could you explain how this could happen? I don't know the specifics about how QR codes are generated, but it looks like there are alternating "white" and "black" tiles, so maybe it could be related so some kind of padding?
I found the issue. One of the libraries that was used in that project overwrote the stringToBytes
method of qrcode-generator
, which broke the functionality when passing in a regular string.
Sorry for wasting your time and thanks for creating this great library.
We built a library (beacon-sdk) that is using this library to generate QR codes. There are many apps using our library and it works without any issues.
However, I recently tried adding our library to a specific react project and for some reason, the QR code that is generated on that site is invalid. It seems to have a weird "pattern" as shown in the example below.
Because it works without any problems in 99% of the cases, I'm pretty sure this is somehow related to the project I'm using it in (which is using a reactjs library that itself also relies on
qrcode-generator
. But nonetheless, the error seems to happen within this library.I have no idea how I can go about fixing this issue because everything looks good code wise. Do you have any idea what could be going on? Thanks so much for any help.
This is the code that I'm using to generate the invalid QR code:
Code
Examples
Ascii (in the browser log):
This happens when I change the error correction code to "H":
This happens when I change the data to:
L:![qr-2-l](https://user-images.githubusercontent.com/680814/156459042-78b36a37-6b50-4210-8dd2-8fe957dd9b43.png)
H:
L:![qr-test](https://user-images.githubusercontent.com/680814/156459069-d402647e-f8d6-47e6-b4e6-f285b78a341b.png)