Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func bindData(destination any, data map[string][]string, tag string, dataFiles m
isElemInterface := k == reflect.Interface
isElemString := k == reflect.String
isElemSliceOfStrings := k == reflect.Slice && typ.Elem().Elem().Kind() == reflect.String
if !(isElemSliceOfStrings || isElemString || isElemInterface) {
if !isElemSliceOfStrings && !isElemString && !isElemInterface {
return nil
}
if val.IsNil() {
Expand Down
2 changes: 1 addition & 1 deletion middleware/basic_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (config BasicAuthConfig) ToMiddleware() (echo.MiddlewareFunc, error) {
if i >= limit {
break
}
if !(len(auth) > l+1 && strings.EqualFold(auth[:l], basic)) {
if len(auth) <= l+1 || !strings.EqualFold(auth[:l], basic) {
continue
}
i++
Expand Down
2 changes: 1 addition & 1 deletion middleware/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (config StaticConfig) ToMiddleware() (echo.MiddlewareFunc, error) {
}

var he echo.HTTPStatusCoder
if !(errors.As(err, &he) && config.HTML5 && he.StatusCode() == http.StatusNotFound) {
if !errors.As(err, &he) || !config.HTML5 || he.StatusCode() != http.StatusNotFound {
return err
}
// is case HTML5 mode is enabled + echo 404 we serve index to the client
Expand Down
4 changes: 2 additions & 2 deletions route.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ func (r RouteInfo) Reverse(pathValues ...any) string {
// in case of `*` wildcard or `:` (unescaped colon) param we replace everything till next slash or end of path
for ; i < l && r.Path[i] != '/'; i++ {
}
uri.WriteString(fmt.Sprintf("%v", pathValues[n]))
n++
fmt.Fprintf(uri, "%v", pathValues[n])
n++
}
if i < l {
uri.WriteByte(r.Path[i])
Expand Down
2 changes: 1 addition & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ func (r *DefaultRouter) Route(c *Context) HandlerFunc {
var rInfo *RouteInfo
if matchedRouteMethod != nil {
rHandler = matchedRouteMethod.handler
rPath = matchedRouteMethod.RouteInfo.Path
rPath = matchedRouteMethod.Path
rInfo = matchedRouteMethod.RouteInfo
} else {
// use previous match as basis. although we have no matching handler we have path match.
Expand Down
Loading