Skip to content

Commit eefd258

Browse files
committed
allow doctype svg
1 parent 2ec15d9 commit eefd258

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/base/tool.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const sniffLen = 512
3535
// SVGMimeType MIME type of SVG images.
3636
const SVGMimeType = "image/svg+xml"
3737

38-
var svgTagRegex = regexp.MustCompile(`(?si)\A\s*(?:<!--.*?-->\s*)*<svg[\s>]`)
39-
var svgTagInXMLRegex = regexp.MustCompile(`(?si)\A<\?xml\b.*?\?>\s*(?:<!--.*?-->\s*)*<svg[\s>]`)
38+
var svgTagRegex = regexp.MustCompile(`(?si)\A\s*(?:(<!--.*?-->|<!DOCTYPE\s+svg[\s:]+.*?>)\s*)*<svg[\s>]`)
39+
var svgTagInXMLRegex = regexp.MustCompile(`(?si)\A<\?xml\b.*?\?>\s*(?:(<!--.*?-->|<!DOCTYPE\s+svg[\s:]+.*?>)\s*)*<svg[\s>]`)
4040

4141
// EncodeMD5 encodes string to md5 hex value.
4242
func EncodeMD5(str string) string {

0 commit comments

Comments
 (0)