Skip to content

Commit 652322b

Browse files
committed
use existing ensureLeadingSlash function to
1 parent 2a32861 commit 652322b

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

cgi.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,9 @@ func splitCgiPath(fc *frankenPHPContext) {
218218
}
219219

220220
// Strip PATH_INFO from SCRIPT_NAME
221-
fc.scriptName = strings.TrimSuffix(path, fc.pathInfo)
222-
223221
// Ensure the SCRIPT_NAME has a leading slash for compliance with RFC3875
224222
// Info: https://tools.ietf.org/html/rfc3875#section-4.1.13
225-
if fc.scriptName != "" && !strings.HasPrefix(fc.scriptName, "/") {
226-
fc.scriptName = "/" + fc.scriptName
227-
}
223+
fc.scriptName = ensureLeadingSlash(strings.TrimSuffix(path, fc.pathInfo))
228224

229225
// TODO: is it possible to delay this and avoid saving everything in the context?
230226
// SCRIPT_FILENAME is the absolute path of SCRIPT_NAME

0 commit comments

Comments
 (0)