Skip to content

Commit b632a5e

Browse files
committed
safety check for separator, in case someone uses matchers
1 parent 0a294ac commit b632a5e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cgi.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ func splitCgiPath(fc *frankenPHPContext) {
213213
// If a worker is already assigned explicitly, derive SCRIPT_NAME from its filename
214214
if fc.worker != nil {
215215
fc.scriptFilename = fc.worker.fileName
216-
if strings.HasPrefix(fc.worker.fileName, fc.documentRoot) {
216+
docRootWithSep := fc.documentRoot + string(filepath.Separator)
217+
if strings.HasPrefix(fc.worker.fileName, docRootWithSep) {
217218
fc.scriptName = filepath.ToSlash(strings.TrimPrefix(fc.worker.fileName, fc.documentRoot))
218219
} else {
219220
fc.pathInfo = ""

0 commit comments

Comments
 (0)