@@ -29,23 +29,24 @@ import (
29
29
"github.com/symfony-cli/symfony-cli/envs"
30
30
)
31
31
32
- func (p * Server ) resolveIndexFile (pathInfo string ) (string , string ) {
33
-
32
+ func (p * Server ) resolveScriptName (pathInfo string ) (string , string ) {
34
33
if pos := strings .Index (strings .ToLower (pathInfo ), ".php" ); pos != - 1 {
35
34
file := pathInfo [:pos + 4 ]
36
35
if _ , err := os .Stat (filepath .Join (p .documentRoot , file )); err == nil {
37
36
return file , pathInfo [pos + 4 :]
38
37
}
39
-
40
38
}
41
39
42
40
if len (pathInfo ) > 1 {
43
41
paths := strings .Split (strings .Trim (pathInfo , "/" ), "/" )
44
42
for n := len (paths ); n > 0 ; n -- {
45
- indexDir := filepath .Join (paths [:n ]... )
46
- file := filepath .Join (indexDir , p .passthru )
43
+ if paths [n - 1 ] == "" {
44
+ continue
45
+ }
46
+
47
+ file := filepath .Join (append (paths [:n ], p .passthru )... )
47
48
if _ , err := os .Stat (filepath .Join (p .documentRoot , file )); err == nil {
48
- return "/" + file , pathInfo [strings .Index (pathInfo , indexDir )+ len (indexDir ):]
49
+ return "/" + file , pathInfo [strings .LastIndex (pathInfo , paths [ n - 1 ] )+ len (paths [ n - 1 ] ):]
49
50
}
50
51
}
51
52
}
@@ -54,8 +55,7 @@ func (p *Server) resolveIndexFile(pathInfo string) (string, string) {
54
55
}
55
56
56
57
func (p * Server ) generateEnv (req * http.Request ) map [string ]string {
57
-
58
- scriptName , pathInfo := p .resolveIndexFile (req .URL .Path )
58
+ scriptName , pathInfo := p .resolveScriptName (req .URL .Path )
59
59
60
60
https := ""
61
61
if req .TLS != nil {
0< 31B8 !-- --> commit comments