1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-11 07:01:03 +00:00

Merge pull request #1376 from JessonChan/develop

static file code refactor and bug fixed
This commit is contained in:
astaxie
2015-11-08 23:21:16 +08:00
4 changed files with 109 additions and 110 deletions

View File

@ -523,18 +523,19 @@ 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)
fileExts := []string{}
for _, ext := range extensions {
ext = strings.TrimSpace(ext)
if ext == "" {
continue
}
if !strings.HasPrefix(ext, ".") {
ext = "." + ext
}
fileExts = append(fileExts, ext)
}
if len(fileExts) > 0 {
StaticExtensionsToGzip = fileExts
}
}