Merge deb81c1d094026569067fabb5fad1eca258f6fbb into 52ecf029bd2e9b4d2652f96dd2b753f8bc6b6e95

This commit is contained in:
李若 2025-11-26 23:43:49 +08:00 committed by GitHub
commit 924ee98339
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -832,7 +832,7 @@ walk: // Outer loop for walking the tree
return nil
}
n = n.children[0]
n = n.children[len(n.children)-1]
switch n.nType {
case param:
// Find param end (either '/' or path end)

View File

@ -751,6 +751,8 @@ func TestTreeFindCaseInsensitivePath(t *testing.T) {
"/w/𠜎", // 4 byte
"/w/𠜏/", // 4 byte
longPath,
"/param/same/:id",
"/param/same/1",
}
for _, route := range routes {
@ -844,6 +846,7 @@ func TestTreeFindCaseInsensitivePath(t *testing.T) {
{"/w/𠜎/", "/w/𠜎", true, true},
{"/w/𠜏", "/w/𠜏/", true, true},
{lOngPath, longPath, true, true},
{"/param/same/prefix/noexist", "", false, false},
}
// With fixTrailingSlash = true
for _, test := range tests {