From 454e3ac203bb1f0157792245a20abeb98aa855fa Mon Sep 17 00:00:00 2001 From: GhostCore07 <95188751+GhostCore07@users.noreply.github.com> Date: Wed, 28 Sep 2022 09:00:14 -0400 Subject: [PATCH] avoid duplication of .gz suffix prevents an issue where when a .gz file is requested it attempts to append an additional .gz suffix prior to checking if the file exists, i.e. the extension becomes .gz.gz --- lib/core/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/index.js b/lib/core/index.js index 920e55b9..953310a4 100644 --- a/lib/core/index.js +++ b/lib/core/index.js @@ -201,7 +201,7 @@ module.exports = function createMiddleware(_dir, _options) { ) ); // determine compressed forms if they were to exist - gzippedFile = `${file}.gz`; + gzippedFile = file.slice(-3) === ".gz" ? file : `${file}.gz`; brotliFile = `${file}.br`; Object.keys(headers).forEach((key) => {