1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 09:30:56 +00:00

Merge pull request #4014 from jianzhiyao/develop

over size file do not run openFile
This commit is contained in:
Ming Deng 2020-06-19 20:19:16 +08:00 committed by GitHub
commit b9fbcbd906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,6 +68,10 @@ func serverStaticRouter(ctx *context.Context) {
http.ServeFile(ctx.ResponseWriter, ctx.Request, filePath) http.ServeFile(ctx.ResponseWriter, ctx.Request, filePath)
} }
return return
} else if fileInfo.Size() > int64(BConfig.WebConfig.StaticCacheFileSize) {
//over size file serve with http module
http.ServeFile(ctx.ResponseWriter, ctx.Request, filePath)
return
} }
var enableCompress = BConfig.EnableGzip && isStaticCompress(filePath) var enableCompress = BConfig.EnableGzip && isStaticCompress(filePath)