From c2da4491b0f49ae9781e65f6bb4360e65ac8d70b Mon Sep 17 00:00:00 2001 From: NI Date: Thu, 16 Jul 2020 09:34:32 +0800 Subject: [PATCH] Stop gzip more file types: Text, MD --- application/controller/static_page_generater/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/application/controller/static_page_generater/main.go b/application/controller/static_page_generater/main.go index 495438f..5fff612 100644 --- a/application/controller/static_page_generater/main.go +++ b/application/controller/static_page_generater/main.go @@ -280,6 +280,12 @@ func getMimeTypeByExtension(ext string) string { case ".md": return "text/markdown" + case ".map": + return "text/plain" + + case ".txt": + return "text/plain" + case ".woff": return "application/font-woff" @@ -318,6 +324,8 @@ func parseFile( // Don't compress images } else if strings.HasPrefix(mimeType, "application/font-woff") { // Don't compress web fonts + } else if mimeType == "text/plain" { + // Don't compress plain text } else { compressed := bytes.NewBuffer(make([]byte, 0, 1024))