Merge c53bdbaf64ed9a46b418ac94572147b1197f9fbf into 5c6a15f8f9566612076bd209e623861bf92a6283

This commit is contained in:
Liu yuyan 2026-09-16 23:09:16 +03:00 committed by GitHub
commit b337f42cf7
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)
}