#1399[FIX] file server in subdomain with request path "/"

Former-commit-id: 30a86cba134b87db803aa47a277795717c694c3b
This commit is contained in:
minhvh 2019-12-03 10:51:00 +07:00
parent fe02ad938a
commit 6dcbbc5464
2 changed files with 2 additions and 2 deletions

View File

@ -233,7 +233,7 @@ func splitSubdomainAndPath(fullUnparsedPath string) (subdomain string, path stri
splitPath := strings.Split(s, ".")
if len(splitPath) == 2 && splitPath[1] == "" {
return splitPath[0] + ".", "/"
return splitPath[0], "/"
}
slashIdx := strings.IndexByte(s, '/')

View File

@ -116,7 +116,7 @@ func TestSplitSubdomainAndPath(t *testing.T) {
path string
}{
{"admin./users/42", "admin.", "/users/42"},
{"admin.", "admin.", "/"},
{"admin.", "admin", "/"},
{"admin./" + WildcardFileParam(), "admin.", "/" + WildcardFileParam()},
{"//api/users\\42", "", "/api/users/42"},
{"admin./users//42", "admin.", "/users/42"},