Rename IMGPROXY_ENABLE_*_DETECTION configs to IMGPROXY_AUTO_*

This commit is contained in:
DarthSim
2024-12-08 19:26:58 +03:00
parent 3f4edb91f7
commit 90e5f19a6e
5 changed files with 36 additions and 19 deletions

View File

@@ -1081,17 +1081,17 @@ func defaultProcessingOptions(headers http.Header) (*ProcessingOptions, error) {
headerAccept := headers.Get("Accept")
if strings.Contains(headerAccept, "image/webp") {
po.PreferWebP = config.EnableWebpDetection || config.EnforceWebp
po.PreferWebP = config.AutoWebp || config.EnforceWebp
po.EnforceWebP = config.EnforceWebp
}
if strings.Contains(headerAccept, "image/avif") {
po.PreferAvif = config.EnableAvifDetection || config.EnforceAvif
po.PreferAvif = config.AutoAvif || config.EnforceAvif
po.EnforceAvif = config.EnforceAvif
}
if strings.Contains(headerAccept, "image/jxl") {
po.PreferJxl = config.EnableJxlDetection || config.EnforceJxl
po.PreferJxl = config.AutoJxl || config.EnforceJxl
po.EnforceJxl = config.EnforceJxl
}

View File

@@ -478,7 +478,7 @@ func (s *ProcessingOptionsTestSuite) TestParsePathStripMetadata() {
}
func (s *ProcessingOptionsTestSuite) TestParsePathWebpDetection() {
config.EnableWebpDetection = true
config.AutoWebp = true
path := "/plain/http://images.dev/lorem/ipsum.jpg"
headers := http.Header{"Accept": []string{"image/webp"}}