mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 06:00:49 +00:00
减少没有必要的代码以及静态前缀前面有/
This commit is contained in:
parent
56dc9bf622
commit
33ef34b95d
@ -256,13 +256,12 @@ func parseConfig(appConfigPath string) (err error) {
|
||||
sds := strings.Fields(sd)
|
||||
for _, v := range sds {
|
||||
if url2fsmap := strings.SplitN(v, ":", 2); len(url2fsmap) == 2 {
|
||||
BConfig.WebConfig.StaticDir["/"+strings.TrimRight(url2fsmap[0], "/")] = url2fsmap[1]
|
||||
BConfig.WebConfig.StaticDir["/"+strings.Trim(url2fsmap[0], "/")] = url2fsmap[1]
|
||||
} else {
|
||||
BConfig.WebConfig.StaticDir["/"+strings.TrimRight(url2fsmap[0], "/")] = url2fsmap[0]
|
||||
BConfig.WebConfig.StaticDir["/"+strings.Trim(url2fsmap[0], "/")] = url2fsmap[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if sgz := AppConfig.String("StaticExtensionsToGzip"); sgz != "" {
|
||||
extensions := strings.Split(sgz, ",")
|
||||
fileExts := []string{}
|
||||
|
@ -157,13 +157,10 @@ func searchFile(ctx *context.Context) (string, os.FileInfo, error) {
|
||||
return filePath, fi, nil
|
||||
}
|
||||
}
|
||||
return "", nil, errors.New(requestPath + " file not find")
|
||||
return "", nil, errNotStaticRequest
|
||||
}
|
||||
|
||||
for prefix, staticDir := range BConfig.WebConfig.StaticDir {
|
||||
if len(prefix) == 0 {
|
||||
continue
|
||||
}
|
||||
if !strings.Contains(requestPath, prefix) {
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user