Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit d1d0455

Browse files
committed
Clean path before validating app
Use filepath.Clean() to clean the path arg in docker app validate so that the path is correctly tested on both Unix and Windows machines. Signed-off-by: Nick Adcock <[email protected]>
1 parent 9a49da4 commit d1d0455

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

internal/names.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func AppNameFromDir(dirName string) string {
9595
// DirNameFromAppName takes an application name and returns the
9696
// corresponding directory name
9797
func DirNameFromAppName(appName string) string {
98-
if strings.HasSuffix(strings.TrimSuffix(appName, "/"), AppExtension) {
98+
if strings.HasSuffix(filepath.Clean(appName), AppExtension) {
9999
return appName
100100
}
101101
return appName + AppExtension

internal/names_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func TestDirNameFromAppName(t *testing.T) {
3737
{name: "", expected: ".dockerapp"},
3838
{name: "foo/bar", expected: "foo/bar.dockerapp"},
3939
{name: "foo/bar.dockerapp", expected: "foo/bar.dockerapp"},
40+
{name: "foo/bar.dockerapp/", expected: "foo/bar.dockerapp/"},
4041
// FIXME(vdemeester) we should fail here
4142
{name: "foo/bar/", expected: "foo/bar/.dockerapp"},
4243
{name: "/foo/bar.dockerapp", expected: "/foo/bar.dockerapp"},

0 commit comments

Comments
 (0)