diff --git a/pkg/cache/cache_opts.go b/pkg/cache/cache_opts.go index 07e0f57fd..19767446f 100644 --- a/pkg/cache/cache_opts.go +++ b/pkg/cache/cache_opts.go @@ -66,7 +66,7 @@ func (c *CacheOpts) Set(value string) error { return errors.Errorf("invalid field '%s' must be a key=value pair", field) } key := strings.ToLower(parts[0]) - value := strings.ToLower(parts[1]) + value := parts[1] if key == "type" { switch value { case "build": @@ -86,7 +86,7 @@ func (c *CacheOpts) Set(value string) error { return errors.Errorf("invalid field '%s' must be a key=value pair", field) } key := strings.ToLower(parts[0]) - value := strings.ToLower(parts[1]) + value := parts[1] switch key { case "format": switch value { diff --git a/pkg/cache/cache_opts_test.go b/pkg/cache/cache_opts_test.go index dd28e1acb..4694e06da 100644 --- a/pkg/cache/cache_opts_test.go +++ b/pkg/cache/cache_opts_test.go @@ -235,6 +235,16 @@ func testCacheOpts(t *testing.T, when spec.G, it spec.S) { input: fmt.Sprintf("type=launch;format=bind;source=%s/test-bind-volume-cache", homeDir), output: fmt.Sprintf("type=build;format=volume;type=launch;format=bind;source=%s/test-bind-volume-cache/launch-cache;", homeDir), }, + { + name: "Case sensitivity test with uppercase path", + input: fmt.Sprintf("type=build;format=bind;source=%s/TestBindBuildCache", homeDir), + output: fmt.Sprintf("type=build;format=bind;source=%s/TestBindBuildCache/build-cache;type=launch;format=volume;", homeDir), + }, + { + name: "Case sensitivity test with mixed case path", + input: fmt.Sprintf("type=build;format=bind;source=%s/TeStBiNdBuildCaChe", homeDir), + output: fmt.Sprintf("type=build;format=bind;source=%s/TeStBiNdBuildCaChe/build-cache;type=launch;format=volume;", homeDir), + }, } } else { testcases = []CacheOptTestCase{ @@ -253,6 +263,17 @@ func testCacheOpts(t *testing.T, when spec.G, it spec.S) { input: fmt.Sprintf("type=launch;format=bind;source=%s\\test-bind-volume-cache", homeDir), output: fmt.Sprintf("type=build;format=volume;type=launch;format=bind;source=%s\\test-bind-volume-cache\\launch-cache;", homeDir), }, + // Case sensitivity test cases for Windows + { + name: "Case sensitivity test with uppercase path", + input: fmt.Sprintf("type=build;format=bind;source=%s\\TestBindBuildCache", homeDir), + output: fmt.Sprintf("type=build;format=bind;source=%s\\TestBindBuildCache\\build-cache;type=launch;format=volume;", homeDir), + }, + { + name: "Case sensitivity test with mixed case path", + input: fmt.Sprintf("type=build;format=bind;source=%s\\TeStBiNdBuildCaChe", homeDir), + output: fmt.Sprintf("type=build;format=bind;source=%s\\TeStBiNdBuildCaChe\\build-cache;type=launch;format=volume;", homeDir), + }, } }