// searchFile search the file by url path
// if none the static file prefix matches ,return notStaticRequestErr

searchFile search the file by url path
if none the static file prefix matches ,return notStaticRequestErr
// searchFile search the file by url path // if none the static file prefix matches return notStaticRequestErr
func searchFile(ctx *context.Context) (string, os.FileInfo, error) {
	requestPath := filepath.ToSlash(filepath.Clean(ctx.Request.URL.Path))
	if requestPath == "/favicon.ico" || requestPath == "/robots.txt" {
		file := path.Join(".", requestPath)
		if fi, _ := os.Stat(file); fi != nil {
			return file, fi, nil
		}
		for _, staticDir := range BConfig.WebConfig.StaticDir {
			filePath := path.Join(staticDir, requestPath)
			if fi, _ := os.Stat(filePath); fi != nil {
				return filePath, fi, nil
			}
		}
		return "", nil, errNotStaticRequest
	}
	for prefix, staticDir := range BConfig.WebConfig.StaticDir {
		if !strings.Contains(requestPath, prefix) {
			continue
		}
		if len(requestPath) > len(prefix) && requestPath[len(prefix)] != '/' {
			continue
		}
		filePath := path.Join(staticDir, requestPath[len(prefix):])
		if fi, err := os.Stat(filePath); fi != nil {
			return filePath, fi, err
		}
	}
	return "", nil, errNotStaticRequest
}
func searchFile ( ctx * context . Context ) ( string , os . FileInfo , error ) { requestPath := filepath . ToSlash ( filepath . Clean ( ctx . Request . URL . Path ) ) if requestPath == " " || requestPath == " " { file := path . Join ( " " , requestPath ) if fi , _ := os . Stat ( file ) ; fi != nil { return file , fi , nil } for _ , staticDir := range BConfig . WebConfig . StaticDir { filePath := path . Join ( staticDir , requestPath ) if fi , _ := os . Stat ( filePath ) ; fi != nil { return filePath , fi , nil } } return " " , nil , errNotStaticRequest } for prefix , staticDir := range BConfig . WebConfig . StaticDir { if ! strings . Contains ( requestPath , prefix ) { continue } if len ( requestPath ) > len ( prefix ) && requestPath [ len ( prefix ) ] != '/' { continue } filePath := path . Join ( staticDir , requestPath [ len ( prefix ) : ] ) if fi , err := os . Stat ( filePath ) ; fi != nil { return filePath , fi , err } } return " " , nil , errNotStaticRequest }
searchFile search the file by url path
if none the static file prefix matches ,return notStaticRequestErr
searchFile search the file by url path if none the static file prefix matches return notStaticRequestErr
// special processing : favicon.ico/robots.txt  can be in any static dir
