diff --git a/frontend/dockerfile/dockerfile_test.go b/frontend/dockerfile/dockerfile_test.go index 6f8915e01bc1..3badb4d40db1 100644 --- a/frontend/dockerfile/dockerfile_test.go +++ b/frontend/dockerfile/dockerfile_test.go @@ -152,6 +152,7 @@ var allTests = integration.TestFuncs( testNamedMultiplatformInputContext, testNamedFilteredContext, testEmptyDestDir, + testPreserveDestDirSlash, testCopyLinkDotDestDir, testCopyLinkEmptyDestDir, testCopyChownCreateDest, @@ -547,6 +548,42 @@ RUN cmd /V:on /C "set /p tfcontent= "/sample". Using "/" since eventually the +// path goes through the `ToSlash` function. +func keepTrailingSlash(path, inputOS string) string { + if inputOS == "windows" && + len(path) > 1 && + (strings.HasSuffix(path, "/") || strings.HasSuffix(path, "\\")) { + return "/" + } + return "" }