1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-08 10:45:04 +02:00

Remove unneeded attributes when stripping XMP

This commit is contained in:
DarthSim 2022-11-08 20:34:04 +06:00
parent b17d6c400c
commit 0e62ebc614
2 changed files with 12 additions and 2 deletions

View File

@ -3,8 +3,8 @@
## [Unreleased]
### Add
- Add `IMGPROXY_OPEN_TELEMETRY_GRPC_INSECURE` config.
- Better XMP data stripping.
- (pro) Add XMP data to the `/info` response.
- (pro) Better XMP data stripping.
## [3.10.0] - 2022-11-04
### Add

View File

@ -62,11 +62,21 @@ func stripXMP(img *vips.Image) []byte {
if n.Name() == "dc" {
filteredNodes := n.Nodes[:0]
for _, nn := range n.Nodes {
if nn.Name() == "rights" || nn.Name() == "contributor" || nn.Name() == "creator" || nn.Name() == "publisher" {
name := nn.Name()
if name == "rights" || name == "contributor" || name == "creator" || name == "publisher" {
filteredNodes = append(filteredNodes, nn)
}
}
n.Nodes = filteredNodes
filteredAttrs := n.Attr[:0]
for _, a := range n.Attr {
name := a.Name.Local
if name == "dc:rights" || name == "dc:contributor" || name == "dc:creator" || name == "dc:publisher" {
filteredAttrs = append(filteredAttrs, a)
}
}
n.Attr = filteredAttrs
}
}