Skip to content

Commit

Permalink
Fixes #81
Browse files Browse the repository at this point in the history
  • Loading branch information
Mat Ryer committed Feb 4, 2014
1 parent 8ac7596 commit 6a92a00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions paths/path_pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,14 @@ func (p *PathPattern) GetPathMatch(path *Path) *PathMatch {
switch getSegmentType(checkSegment) {
case segmentTypeLiteral:

pathSegment := pathSegments[segmentIndex]
if strings.ToLower(pathSegment) != strings.ToLower(checkSegment) {
if segmentIndex < len(pathSegments) {

pathSegment := pathSegments[segmentIndex]
if strings.ToLower(pathSegment) != strings.ToLower(checkSegment) {
return PathDoesntMatch
}

} else {
return PathDoesntMatch
}

Expand Down
2 changes: 2 additions & 0 deletions paths/path_pattern_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,6 @@ func TestIssue81(t *testing.T) {
assert.NotPanics(t, func() {
assert.False(t, p.GetPathMatch(NewPath("/prefix/")).Matches)
})
assert.True(t, p.GetPathMatch(NewPath("/prefix/static")).Matches)
assert.False(t, p.GetPathMatch(NewPath("/static")).Matches)
}

0 comments on commit 6a92a00

Please sign in to comment.