enhance cleanPath from httprouter patch

This commit is contained in:
thinkerou 2018-08-10 17:15:30 +08:00
parent 1f1bc429ed
commit 4a1688518c

View File

@ -59,11 +59,11 @@ func cleanPath(p string) string {
case p[r] == '.' && p[r+1] == '/':
// . element
r++
r += 2
case p[r] == '.' && p[r+1] == '.' && (r+2 == n || p[r+2] == '/'):
// .. element: remove to last /
r += 2
r += 3
if w > 1 {
// can backtrack