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

Assigning 'qrcode' externally causes the library to fail decoding of QR codes. #51

Closed
antheroo opened this issue Jun 1, 2020 · 1 comment · Fixed by #62
Closed

Assigning 'qrcode' externally causes the library to fail decoding of QR codes. #51

antheroo opened this issue Jun 1, 2020 · 1 comment · Fixed by #62

Comments

@antheroo
Copy link

antheroo commented Jun 1, 2020

Describe the bug
The library internally utilizes 3rd party 'qrcode' module for QR-code decoding tasks. However there is not sufficient abstraction such that assigning 'qrcode' to something else externally to the library will cause the library to fail and flag errors such as qrcode.decode() failures.

To Reproduce
Steps to reproduce the behavior:

  1. Assign qrcode to something else after Html5Qrcode has been initialized:
const html5QrCode = new Html5Qrcode(/* element id */ "reader");
var qrcode = '';
  1. Start html5QrCode as usual, but parse the error.

  2. Observed error:

QR code parse error, error = TypeError: qrcode.decode is not a function

Expected behavior
It would be ideal to have sufficient abstraction such that assigning 'qrcode' externally to something else will not cause the library to break. Either that or mention it as a reserved word in the README.

Screenshots
N/A

Desktop (please complete the following information):

  • Any

Smartphone (please complete the following information):

  • Any

Additional context
N/A

Thanks!
Andrew

@mebjas
Copy link
Owner

mebjas commented Jun 13, 2020

I have hidden qrcode behind a function, so that it cannot be overridden globally. This'd be published in v1.1.3

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

Successfully merging a pull request may close this issue.

2 participants