1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-23 03:10:50 +00:00

modified as astaxie reviews

https://github.com/astaxie/beego/pull/1376
This commit is contained in:
JessonChan 2015-11-06 18:51:53 +08:00
parent 1abf85ed2a
commit 860568cb6c
3 changed files with 4 additions and 6 deletions

View File

@ -529,7 +529,6 @@ func ParseConfig() (err error) {
if ext == "" {
continue
}
ext = strings.ToLower(ext)
if !strings.HasPrefix(ext, ".") {
ext = "." + ext
}

View File

@ -206,9 +206,9 @@ func getAcceptEncodingZip(r *http.Request) string {
ss = strings.ToLower(ss)
if strings.Contains(ss, "gzip") {
return "gzip"
}
if strings.Contains(ss, "deflate") {
} else if strings.Contains(ss, "deflate") {
return "deflate"
} else {
return ""
}
return ""
}

View File

@ -96,9 +96,8 @@ func serverStaticRouter(ctx *context.Context) {
}
isStaticFileToCompress := false
lowerFileName := strings.ToLower(filePath)
for _, statExtension := range StaticExtensionsToGzip {
if strings.HasSuffix(lowerFileName, statExtension) {
if strings.HasSuffix(strings.ToLower(filePath), strings.ToLower(statExtension)) {
isStaticFileToCompress = true
break
}