From b9fb3a62f56f910292c566609bf1453628798662 Mon Sep 17 00:00:00 2001 From: JessonChan Date: Tue, 22 Sep 2015 11:59:48 +0800 Subject: [PATCH] static file name default lower case --- config.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/config.go b/config.go index 6f87fed1..4751b7e4 100644 --- a/config.go +++ b/config.go @@ -523,18 +523,16 @@ func ParseConfig() (err error) { if sgz := AppConfig.String("StaticExtensionsToGzip"); sgz != "" { extensions := strings.Split(sgz, ",") - if len(extensions) > 0 { - StaticExtensionsToGzip = []string{} - for _, ext := range extensions { - if len(ext) == 0 { - continue - } - extWithDot := ext - if extWithDot[:1] != "." { - extWithDot = "." + extWithDot - } - StaticExtensionsToGzip = append(StaticExtensionsToGzip, extWithDot) + for _, ext := range extensions { + ext = strings.TrimSpace(ext) + if ext == "" { + continue } + ext = strings.ToLower(ext) + if !strings.HasPrefix(ext, ".") { + ext = "." + ext + } + StaticExtensionsToGzip = append(StaticExtensionsToGzip, ext) } }