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

GeneratedSVG is invalid in HTML #317

Open
xi opened this issue Feb 27, 2023 · 1 comment
Open

GeneratedSVG is invalid in HTML #317

xi opened this issue Feb 27, 2023 · 1 comment

Comments

@xi
Copy link

xi commented Feb 27, 2023

Since 7.4 the generated SVG looks like this:

<svg width="45mm" height="45mm" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <svg:rect xmlns:svg="http://www.w3.org/2000/svg" x="4mm" y="4mm" width="1mm" height="1mm" fill="#000"></svg:rect>
  …
</svg>

Note the namespace on the rect element. This is not only unnecessary, it is even invalid when used inline with HTML

The HTML syntax does not support namespace declarations
-- https://html.spec.whatwg.org/multipage/syntax.html#elements-2

As far as I can tell this was introduced in 2287382. Before that, SvgFragmentImage._rect() used a namespaced tag by default, but SvgImage._rect() overwrote that to use a non-namespaced tag. Since 2287382, SvgSquareDrawer.drawrect() is used in both cases, which always uses a namespaced tag.

xi added a commit to xi/django-mfa3 that referenced this issue Feb 27, 2023
@leveraction
Copy link

Same problem. "<rect " has become "<svg:rect" and this results in my qr code svg image coming out as a white square where it used to work. Reverting back to 7.3.1 in the meantime.

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

2 participants