mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-05 19:23:07 +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 `X-Origin-Height` and `X-Result-Height` debug header values for animated images.
|
||||||
- Fix keeping copyright info in EXIF.
|
- Fix keeping copyright info in EXIF.
|
||||||
- Fix preserving color profiles in TIFF images.
|
- 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 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.
|
- (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 {
|
for {
|
||||||
tt, tdata := l.Next()
|
tt, tdata := l.Next()
|
||||||
|
|
||||||
if ignoreTag > 0 {
|
if tt == xml.ErrorToken {
|
||||||
switch tt {
|
if l.Err() != io.EOF {
|
||||||
case xml.ErrorToken:
|
|
||||||
cancel()
|
cancel()
|
||||||
return nil, newSanitizeError(l.Err())
|
return nil, newSanitizeError(l.Err())
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if ignoreTag > 0 {
|
||||||
|
switch tt {
|
||||||
case xml.EndTagToken, xml.StartTagCloseVoidToken:
|
case xml.EndTagToken, xml.StartTagCloseVoidToken:
|
||||||
ignoreTag--
|
ignoreTag--
|
||||||
case xml.StartTagToken:
|
case xml.StartTagToken:
|
||||||
@@ -56,19 +61,6 @@ func Sanitize(data imagedata.ImageData) (imagedata.ImageData, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch tt {
|
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:
|
case xml.StartTagToken:
|
||||||
curTagName = strings.ToLower(string(l.Text()))
|
curTagName = strings.ToLower(string(l.Text()))
|
||||||
|
|
||||||
@@ -97,4 +89,12 @@ func Sanitize(data imagedata.ImageData) (imagedata.ImageData, error) {
|
|||||||
buf.Write(tdata)
|
buf.Write(tdata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newData := imagedata.NewFromBytesWithFormat(
|
||||||
|
imagetype.SVG,
|
||||||
|
buf.Bytes(),
|
||||||
|
)
|
||||||
|
newData.AddCancel(cancel)
|
||||||
|
|
||||||
|
return newData, nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user