From f46c19cac0f1a80e596b38604a71836e024689a5 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Tue, 20 Jan 2026 22:48:21 +0100 Subject: [PATCH] sendfile: Only use encoded variants if they're smaller than the original. --- src/compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compress.c b/src/compress.c index e03760f..6154687 100644 --- a/src/compress.c +++ b/src/compress.c @@ -270,7 +270,7 @@ int ccopen(char *path, struct stat *sb, char *accept, const char **encoding) for(i = 0; i < types.d; i++) { if((type = findtype(types.b[i])) != NULL) { if((efd = openbytype(type, fd, sb, &esb)) >= 0) { - if((mfd < 0) || (esb.st_size < minsz)) { + if((esb.st_size < sb->st_size) && ((mfd < 0) || (esb.st_size < minsz))) { if(mfd >= 0) close(mfd); mfd = efd; -- 2.39.5