mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-09-26 11:38:01 +02:00
Merge branch 'master' into version/4
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
- Fix `X-Origin-Height` and `X-Result-Height` debug header values for animated images.
|
||||
- Fix keeping copyright info in EXIF.
|
||||
- Fix preserving color profiles in TIFF images.
|
||||
- Fix freezes during sanitization or minification of some broken SVGs.
|
||||
- (pro) Fix generating thumbnails for VP9 videos with high bit depth.
|
||||
- (pro) Fix `IMGPROXY_CUSTOM_RESPONSE_HEADERS` and `IMGPROXY_RESPONSE_HEADERS_PASSTHROUGH` configs behavior when the `raw` processing option is used.
|
||||
|
||||
|
32
svg/svg.go
32
svg/svg.go
@@ -41,11 +41,16 @@ func Sanitize(data imagedata.ImageData) (imagedata.ImageData, error) {
|
||||
for {
|
||||
tt, tdata := l.Next()
|
||||
|
||||
if ignoreTag > 0 {
|
||||
switch tt {
|
||||
case xml.ErrorToken:
|
||||
if tt == xml.ErrorToken {
|
||||
if l.Err() != io.EOF {
|
||||
cancel()
|
||||
return nil, newSanitizeError(l.Err())
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if ignoreTag > 0 {
|
||||
switch tt {
|
||||
case xml.EndTagToken, xml.StartTagCloseVoidToken:
|
||||
ignoreTag--
|
||||
case xml.StartTagToken:
|
||||
@@ -56,19 +61,6 @@ func Sanitize(data imagedata.ImageData) (imagedata.ImageData, error) {
|
||||
}
|
||||
|
||||
switch tt {
|
||||
case xml.ErrorToken:
|
||||
if l.Err() != io.EOF {
|
||||
cancel()
|
||||
return nil, newSanitizeError(l.Err())
|
||||
}
|
||||
|
||||
newData := imagedata.NewFromBytesWithFormat(
|
||||
imagetype.SVG,
|
||||
buf.Bytes(),
|
||||
)
|
||||
newData.AddCancel(cancel)
|
||||
|
||||
return newData, nil
|
||||
case xml.StartTagToken:
|
||||
curTagName = strings.ToLower(string(l.Text()))
|
||||
|
||||
@@ -97,4 +89,12 @@ func Sanitize(data imagedata.ImageData) (imagedata.ImageData, error) {
|
||||
buf.Write(tdata)
|
||||
}
|
||||
}
|
||||
|
||||
newData := imagedata.NewFromBytesWithFormat(
|
||||
imagetype.SVG,
|
||||
buf.Bytes(),
|
||||
)
|
||||
newData.AddCancel(cancel)
|
||||
|
||||
return newData, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user