Skip to content

Commit

Permalink
small enhance at CleanPath (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
lsytj0413 authored and julienschmidt committed Jul 15, 2018
1 parent adbc77e commit 348b672
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions path.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 348b672

Please sign in to comment.