Merge c53bdbaf64ed9a46b418ac94572147b1197f9fbf into dcaa4296d111981ffb31ac3eba90bb63e1eb5ab9

This commit is contained in:
Liu yuyan 2026-08-29 09:59:25 +00:00 committed by GitHub
commit 28edc07196
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

3
gin.go
View File

@ -743,6 +743,9 @@ func (engine *Engine) handleHTTPRequest(c *Context) {
if tree.method == httpMethod {
continue
}
// Reset skippedNodes before each getValue call to prevent accumulation
// across multiple method trees, which could cause slice bounds panic
*c.skippedNodes = (*c.skippedNodes)[:0]
if value := tree.root.getValue(rPath, nil, c.skippedNodes, unescape); value.handlers != nil {
allowed = append(allowed, tree.method)
}