File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1041,9 +1041,13 @@ func (app *App) ErrorHandler(ctx *Ctx, err error) error {
10411041 mountedPrefixParts int
10421042 )
10431043
1044+ normalizedPath := utils .AddTrailingSlash (ctx .Path ())
1045+
10441046 for _ , prefix := range app .mountFields .appListKeys {
10451047 subApp := app .mountFields .appList [prefix ]
1046- if prefix != "" && strings .HasPrefix (ctx .Path (), prefix ) {
1048+ normalizedPrefix := utils .AddTrailingSlash (prefix )
1049+
1050+ if prefix != "" && strings .HasPrefix (normalizedPath , normalizedPrefix ) {
10471051 parts := len (strings .Split (prefix , "/" ))
10481052 if mountedPrefixParts <= parts {
10491053 if subApp .configured .ErrorHandler != nil {
Original file line number Diff line number Diff line change 44
55package utils
66
7+ import "strings"
8+
79// ToLower converts ascii string to lower-case
810func ToLower (b string ) string {
911 res := make ([]byte , len (b ))
@@ -73,3 +75,11 @@ func EqualFold(b, s string) bool {
7375 }
7476 return true
7577}
78+
79+ func AddTrailingSlash (s string ) string {
80+ if strings .HasSuffix (s , "/" ) {
81+ return s
82+ }
83+
84+ return s + "/"
85+ }
You can’t perform that action at this time.
0 commit comments