mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #35793 from Microsoft/33107
Windows: Case-insensitive filename matching against builder cache
This commit is contained in:
commit
a59061da5f
1 changed files with 9 additions and 2 deletions
|
@ -1,6 +1,10 @@
|
||||||
package tarsum
|
package tarsum
|
||||||
|
|
||||||
import "sort"
|
import (
|
||||||
|
"runtime"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
// FileInfoSumInterface provides an interface for accessing file checksum
|
// FileInfoSumInterface provides an interface for accessing file checksum
|
||||||
// information within a tar file. This info is accessed through interface
|
// information within a tar file. This info is accessed through interface
|
||||||
|
@ -35,8 +39,11 @@ type FileInfoSums []FileInfoSumInterface
|
||||||
|
|
||||||
// GetFile returns the first FileInfoSumInterface with a matching name.
|
// GetFile returns the first FileInfoSumInterface with a matching name.
|
||||||
func (fis FileInfoSums) GetFile(name string) FileInfoSumInterface {
|
func (fis FileInfoSums) GetFile(name string) FileInfoSumInterface {
|
||||||
|
// We do case insensitive matching on Windows as c:\APP and c:\app are
|
||||||
|
// the same. See issue #33107.
|
||||||
for i := range fis {
|
for i := range fis {
|
||||||
if fis[i].Name() == name {
|
if (runtime.GOOS == "windows" && strings.EqualFold(fis[i].Name(), name)) ||
|
||||||
|
(runtime.GOOS != "windows" && fis[i].Name() == name) {
|
||||||
return fis[i]
|
return fis[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue