From a35d78ff9dce84799505dc33e63f2291c2a6c050 Mon Sep 17 00:00:00 2001 From: Zack Olson Date: Tue, 26 Nov 2024 09:40:59 -0500 Subject: [PATCH] always check fallback paths against identifier (#1967) --- pkg/launcher/paths.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/launcher/paths.go b/pkg/launcher/paths.go index af1d68ea1..67fd44f24 100644 --- a/pkg/launcher/paths.go +++ b/pkg/launcher/paths.go @@ -101,6 +101,11 @@ func DetermineRootDirectoryOverride(optsRootDirectory, kolideServerURL, packageI return optsRootDirectory } + // assume the default identifier if none is provided + if strings.TrimSpace(packageIdentifier) == "" { + packageIdentifier = DefaultLauncherIdentifier + } + optsDBLocation := filepath.Join(optsRootDirectory, "launcher.db") dbExists, err := nonEmptyFileExists(optsDBLocation) // If we get an unknown error, back out from making any options changes. This is an @@ -123,8 +128,8 @@ func DetermineRootDirectoryOverride(optsRootDirectory, kolideServerURL, packageI continue } - // If the identifier is set, the path MUST contain the identifier - if packageIdentifier != "" && !strings.Contains(path, packageIdentifier) { + // the fallaback path MUST contain the identifier + if !strings.Contains(path, packageIdentifier) { continue }