forked from mirror/gin
small enhance for cleanPath (#1469)
from httprouter patch: https://github.com/julienschmidt/httprouter/pull/243
This commit is contained in:
parent
1f1bc429ed
commit
8fc8ce0472
4
path.go
4
path.go
|
@ -59,11 +59,11 @@ func cleanPath(p string) string {
|
||||||
|
|
||||||
case p[r] == '.' && p[r+1] == '/':
|
case p[r] == '.' && p[r+1] == '/':
|
||||||
// . element
|
// . element
|
||||||
r++
|
r += 2
|
||||||
|
|
||||||
case p[r] == '.' && p[r+1] == '.' && (r+2 == n || p[r+2] == '/'):
|
case p[r] == '.' && p[r+1] == '.' && (r+2 == n || p[r+2] == '/'):
|
||||||
// .. element: remove to last /
|
// .. element: remove to last /
|
||||||
r += 2
|
r += 3
|
||||||
|
|
||||||
if w > 1 {
|
if w > 1 {
|
||||||
// can backtrack
|
// can backtrack
|
||||||
|
|
Loading…
Reference in New Issue