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

Element identifier used by SvgPathImage should not be hardcoded #384

Open
m000 opened this issue Oct 28, 2024 · 0 comments
Open

Element identifier used by SvgPathImage should not be hardcoded #384

m000 opened this issue Oct 28, 2024 · 0 comments

Comments

@m000
Copy link

m000 commented Oct 28, 2024

SvgPathImage.process() uses the hardcoded element id qr-path for the produced svg path:

https://github.com/lincolnloop/python-qrcode/blame/456b01d41f16e0cfb0f70c687848e276b78c3e8a/qrcode/image/svg.py#L149-L159

This is problematic in cases where the svg qrcodes are inlined in a single html document rather than saved as standalone files. Usually this will not break anything, but it may cause annoyances if the output is fed to a tool that attempts to validate the html that contains the qrcodes.

E.g. I am producing an html file with several qrcodes in it, which I then feed to weasyprint to convert to pdf. I get one warning for each subsequent qrcode:

[2024-10-28 21:21:20 WARNING weasyprint/css/targets.py:94] Anchor defined twice: 'qr-path'

I am not sure if there is a use-case for hardcoding an id there, or even for having an id at all. The path element looks easily selectable using a number of DOM selectors, so id="qr-path" can probably go?

@m000 m000 changed the title Element identifier used by SvgPathImage should not be fixed Element identifier used by SvgPathImage should not be hardcoded Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant