Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read mirrored QR codes #604

Closed
vhtkrk opened this issue Jun 12, 2024 · 3 comments · Fixed by #605
Closed

Unable to read mirrored QR codes #604

vhtkrk opened this issue Jun 12, 2024 · 3 comments · Fixed by #605
Labels

Comments

@vhtkrk
Copy link
Contributor

vhtkrk commented Jun 12, 2024

Describe the bug
If a QR code is mirrored, zxing library is unable to read it.

To Reproduce
Try to scan a mirrored QR code, such as the attached one. At least qrfy.com seems to generate these out of the box.

Expected behavior
The QR code contents ("test2") scanned succesfully.

Screenshots
SCR-20240606-lgbt

Desktop (please complete the following information):

  • OS: MacOS 14 tested
  • Browser: Chrome & Firefox tested
  • Version: Chrome 126, Firefox 126

Smartphone (please complete the following information):

  • Device: Samsung Galaxy Z Flip 5
  • OS: Android 14
  • Browser: Firefox
  • Version: 126

Additional context
So I dug around the source and seems like on a failed scan zxing already tries to mirror the QR code, but is unsuccesful. This seemed perplexing so I dug around and it seems like the fault is at src/core/qrcode/decoder/BitMatrixParser.ts: in remask() if I change the line var dataMask = DataMask.values[this.parsedFormatInfo.getDataMask()]; to var dataMask = DataMask.values.get(this.parsedFormatInfo.getDataMask()); I'm able to read the mirrored code.

@vhtkrk vhtkrk added the bug label Jun 12, 2024
@werthdavid
Copy link
Member

good catch! Can you create a PR?

@vhtkrk
Copy link
Contributor Author

vhtkrk commented Jun 12, 2024

I have to go for now but I'll get you a PR by tomorrow.

@werthdavid
Copy link
Member

--> 0.21.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants