Kaynağa Gözat

small enhance for cleanPath (#1469)

from httprouter patch: https://github.com/julienschmidt/httprouter/pull/243
田欧 7 yıl önce
ebeveyn
işleme
8fc8ce0472
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  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