Skip to content

Commit

Permalink
always check fallback paths against identifier (#1967)
Browse files Browse the repository at this point in the history
  • Loading branch information
zackattack01 authored Nov 26, 2024
1 parent 1824576 commit a35d78f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/launcher/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit a35d78f

Please sign in to comment.