From: Fredrik Tolf Date: Tue, 20 Jan 2026 21:48:21 +0000 (+0100) Subject: sendfile: Only use encoded variants if they're smaller than the original. X-Git-Url: http://www.dolda2000.com/gitweb/?a=commitdiff_plain;h=f46c19cac0f1a80e596b38604a71836e024689a5;p=ashd.git sendfile: Only use encoded variants if they're smaller than the original. --- 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;