mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 06:20:54 +00:00
windows下静态文件映射找不到问题,
path.Clean和filepath.Clean是有区别的
This commit is contained in:
parent
d693ecf046
commit
2c8cb5693e
@ -18,20 +18,18 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/utils"
|
||||
)
|
||||
|
||||
func serverStaticRouter(ctx *context.Context) {
|
||||
|
||||
if ctx.Input.Method() != "GET" && ctx.Input.Method() != "HEAD" {
|
||||
return
|
||||
}
|
||||
requestPath := filepath.Clean(ctx.Input.Request.URL.Path)
|
||||
|
||||
requestPath := path.Clean(ctx.Input.Request.URL.Path)
|
||||
// special processing : favicon.ico/robots.txt can be in any static dir
|
||||
if requestPath == "/favicon.ico" || requestPath == "/robots.txt" {
|
||||
file := path.Join(".", requestPath)
|
||||
|
Loading…
Reference in New Issue
Block a user