Skip to content

Commit

Permalink
add an edge case from httprouter (gin-gonic#1407)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkerou authored and appleboy committed Jun 23, 2018
1 parent 760d057 commit 1f59bad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion path.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func cleanPath(p string) string {
buf[0] = '/'
}

trailing := n > 2 && p[n-1] == '/'
trailing := n > 1 && p[n-1] == '/'

// A bit more clunky without a 'lazybuf' like the path package, but the loop
// gets completely inlined (bufApp). So in contrast to the path package this
Expand Down
1 change: 1 addition & 0 deletions path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var cleanTests = []struct {

// missing root
{"", "/"},
{"a/", "/a/"},
{"abc", "/abc"},
{"abc/def", "/abc/def"},
{"a/b/c", "/a/b/c"},
Expand Down

0 comments on commit 1f59bad

Please sign in to comment.