From ce6f4e88e71ee8965c90354d2af50a35ddd1827e Mon Sep 17 00:00:00 2001 From: Jim Bassett Date: Thu, 17 Oct 2024 17:44:05 +1000 Subject: [PATCH] fix: "invalid reference format" error by avoiding trailing underscore if nested name is not set (#461) --- .../com/avast/gradle/dockercompose/ComposeSettings.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy b/src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy index 2a7abce6..4a949c4d 100644 --- a/src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy +++ b/src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy @@ -97,10 +97,10 @@ abstract class ComposeSettings { return customProjectName } else if (projectNamePrefix) { - return "${projectNamePrefix}_${nestedName}" + return nestedName ? "${projectNamePrefix}_${nestedName}" : projectNamePrefix } else { - return "${safeProjectNamePrefix}_${nestedName}" + return nestedName ? "${safeProjectNamePrefix}_${nestedName}" : safeProjectNamePrefix } }).map{ String projectName -> // docker-compose project names must be lowercase