Fixed SVG circle, ellipse, and line sanitization

Ensures we use the correct attributes so that Y coordinates are not stripped from these elements.

This patch was first attempted by Jiayi (Seven) Du but ended up folding this in myself since the commit message (and associated spec) needed additional updating.

Milestone: patch
This commit is contained in:
Brooke Kuhlmann
2026-07-30 09:17:06 -06:00
parent 6f88917497
commit c8f34c2afe
2 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -43,7 +43,7 @@ attributes:
- height
circle:
- cx
- cv
- cy
- r
- stroke
- stroke-dasharray
@@ -56,9 +56,9 @@ attributes:
- transform
ellipse:
- cx
- cv
- cy
- rx
- rv
- ry
- stroke
- stroke-dasharray
- stroke-dashoffset
@@ -76,8 +76,8 @@ attributes:
line:
- x1
- x2
- v1
- v2
- y1
- y2
- stroke
- stroke-dasharray
- stroke-dashoffset
+3 -3
View File
@@ -37,7 +37,7 @@ RSpec.describe Terminus::Aspects::Sanitizer do
source = <<~HTML.squeeze(" ").delete("\n").strip
<html><head></head>
<body>
<circle cx="5" cv="5" r="5" stroke="#000" stroke-dasharray="6,7" stroke-dashoffset="5" stroke-opacity="0.5" stroke-width="5" fill="#FFF" fill-opacity="0.5" shape-rendering="crispEdges" transform="scale(5)"></circle>
<circle cx="5" cy="5" r="5" stroke="#000" stroke-dasharray="6,7" stroke-dashoffset="5" stroke-opacity="0.5" stroke-width="5" fill="#FFF" fill-opacity="0.5" shape-rendering="crispEdges" transform="scale(5)"></circle>
</body></html>
HTML
@@ -70,7 +70,7 @@ RSpec.describe Terminus::Aspects::Sanitizer do
source = <<~HTML.squeeze(" ").delete("\n").strip
<html><head></head>
<body>
<ellipse cx="5" cv="5" rx="5" rv="5" stroke="#000" stroke-dasharray="6,7" stroke-dashoffset="5" stroke-opacity="0.5" stroke-width="5" fill="#FFF" fill-opacity="0.5" shape-rendering="crispEdges" transform="scale(5)"></ellipse>
<ellipse cx="5" cy="5" rx="5" ry="5" stroke="#000" stroke-dasharray="6,7" stroke-dashoffset="5" stroke-opacity="0.5" stroke-width="5" fill="#FFF" fill-opacity="0.5" shape-rendering="crispEdges" transform="scale(5)"></ellipse>
</body></html>
HTML
@@ -92,7 +92,7 @@ RSpec.describe Terminus::Aspects::Sanitizer do
source = <<~HTML.squeeze(" ").delete("\n").strip
<html><head></head>
<body>
<line x1="5" x2="5" v1="5" v2="5" stroke="#000" stroke-dasharray="6,7" stroke-dashoffset="5" stroke-linecap="round" stroke-width="5" shape-rendering="crispEdges" transform="scale(5)"></line>
<line x1="5" x2="5" y1="5" y2="5" stroke="#000" stroke-dasharray="6,7" stroke-dashoffset="5" stroke-linecap="round" stroke-width="5" shape-rendering="crispEdges" transform="scale(5)"></line>
</body></html>
HTML