Przeglądaj źródła

Fix SVG detection when the root element has a namespace

DarthSim 1 rok temu
rodzic
commit
a23737a90b
2 zmienionych plików z 3 dodań i 1 usunięć
  1. 1 0
      CHANGELOG.md
  2. 2 1
      imagemeta/svg.go

+ 1 - 0
CHANGELOG.md

@@ -6,6 +6,7 @@
 
 ### Fix
 - Fix HEIC/AVIF dimension limit handling.
+- Fix SVG detection when the root element has a namespace.
 - (pro) Fix style injection to SVG.
 
 ## [3.24.1] - 2024-04-30

+ 2 - 1
imagemeta/svg.go

@@ -23,7 +23,8 @@ func IsSVG(r io.Reader) bool {
 			return false
 
 		case xml.StartTagToken:
-			return strings.ToLower(string(l.Text())) == "svg"
+			tag := strings.ToLower(string(l.Text()))
+			return tag == "svg" || tag == "svg:svg"
 		}
 	}
 }