소스 검색

small enhance for cleanPath (#1469)

from httprouter patch: https://github.com/julienschmidt/httprouter/pull/243
田欧 7 년 전
부모
커밋
8fc8ce0472
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      path.go

+ 2 - 2
path.go

@@ -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