Yes, as it turns out, there are actually two shortcuts. Here is a patch. (The parent revision is an old one, but the file was not changed in the meantime.) Thanks for finding the bug.
On 30.09.21 00:24, bes wrote:
Hi, Alex. With your patch and this configuration: image_filter resize 10000000 -; (something wider than input image) image_filter convert webp; no conversion occurs but return headers contain content-type: image/webp I expect that when specifying the conversion filter it will apply anyway. Most likely there is a shortcut somewhere in the algorithm, where after the condition code goes directly to the output, but I could not find it. _______________________________________________ nginx-devel mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx-devel
# HG changeset patch # User Alex Wiens <[email protected]> # Date 1635432878 -7200 # Thu Oct 28 16:54:38 2021 +0200 # Node ID 7df54b0c2627f90053ea8efa1a641ab434528a02 # Parent 7cb31d906c54a8d1a0895fbf32f01f452fe0add7 http_image_filter_module: Fix conversion in case the image is not resized diff -r 7cb31d906c54 -r 7df54b0c2627 src/http/modules/ngx_http_image_filter_module.c --- a/src/http/modules/ngx_http_image_filter_module.c Fri May 07 20:15:33 2021 +0200 +++ b/src/http/modules/ngx_http_image_filter_module.c Thu Oct 28 16:54:38 2021 +0200 @@ -684,7 +684,8 @@ && ctx->width <= ctx->max_width && ctx->height <= ctx->max_height && ctx->angle == 0 - && !ctx->force) + && !ctx->force + && ctx->output_type == ctx->type) { return ngx_http_image_asis(r, ctx); } @@ -1146,7 +1147,7 @@ && ctx->angle == 0 && (ngx_uint_t) sx <= ctx->max_width && (ngx_uint_t) sy <= ctx->max_height - && conf->filter != NGX_HTTP_IMAGE_CONVERT) + && ctx->output_type == ctx->type) { gdImageDestroy(src); return ngx_http_image_asis(r, ctx);
_______________________________________________ nginx-devel mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx-devel
