diff options
| author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2015-11-11 10:21:49 +0900 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-11-12 19:58:37 +0000 |
| commit | 935faf3be200d6f469cccdbec27cee3741a97350 (patch) | |
| tree | eeb46fcc1e1d064da3b56118101cf8fd7b3089aa /src/path/filepath/path.go | |
| parent | b28eeea136ec106a012be8b4278cb06203328c08 (diff) | |
| download | go-935faf3be200d6f469cccdbec27cee3741a97350.tar.xz | |
path/filepath: in Rel use case-insensitive comparison on Windows
Fixes #10802
Compare Volume name and each path elements using strings.EqualFold.
Change-Id: Ibdefdb801d0326e53755bc9cc8c10eed998094e5
Reviewed-on: https://go-review.googlesource.com/16795
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/path/filepath/path.go')
| -rw-r--r-- | src/path/filepath/path.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go index 5dc5cfd49e..681fdfa09f 100644 --- a/src/path/filepath/path.go +++ b/src/path/filepath/path.go @@ -269,7 +269,7 @@ func Rel(basepath, targpath string) (string, error) { // Can't use IsAbs - `\a` and `a` are both relative in Windows. baseSlashed := len(base) > 0 && base[0] == Separator targSlashed := len(targ) > 0 && targ[0] == Separator - if baseSlashed != targSlashed || baseVol != targVol { + if baseSlashed != targSlashed || !sameWord(baseVol, targVol) { return "", errors.New("Rel: can't make " + targ + " relative to " + base) } // Position base[b0:bi] and targ[t0:ti] at the first differing elements. @@ -283,7 +283,7 @@ func Rel(basepath, targpath string) (string, error) { for ti < tl && targ[ti] != Separator { ti++ } - if targ[t0:ti] != base[b0:bi] { + if !sameWord(targ[t0:ti], base[b0:bi]) { break } if bi < bl { |
