Skip to content

Commit

Permalink
clean path before lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
casualjim committed Jan 29, 2017
1 parent 3b13ebb commit 196f817
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions middleware/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (d *defaultRouter) Lookup(method, path string) (*MatchedRoute, bool) {
}
}
if router, ok := d.routers[mth]; ok {
if m, rp, ok := router.Lookup(path); ok && m != nil {
if m, rp, ok := router.Lookup(fpath.Clean(path)); ok && m != nil {
if entry, ok := m.(*routeEntry); ok {
debugLog("found a route for %s %s with %d parameters", method, path, len(entry.Parameters))
var params RouteParams
Expand All @@ -201,7 +201,7 @@ func (d *defaultRouter) OtherMethods(method, path string) []string {
var methods []string
for k, v := range d.routers {
if k != mn {
if _, _, ok := v.Lookup(path); ok {
if _, _, ok := v.Lookup(fpath.Clean(path)); ok {
methods = append(methods, k)
continue
}
Expand Down

0 comments on commit 196f817

Please sign in to comment.