Merge branch 'master' into version/4

This commit is contained in:
DarthSim
2025-09-10 18:05:25 +03:00
2 changed files with 17 additions and 16 deletions

View File

@@ -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.

View File

@@ -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
} }