From 6cef0a1365ee27076bd2a93ed9dddb78a23b3e0d Mon Sep 17 00:00:00 2001 From: Yahav Itzhak Date: Thu, 15 Feb 2024 14:05:23 +0200 Subject: [PATCH] If project flag provided with empty value, act like there is no project (#22) --- cli/scancommands.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/scancommands.go b/cli/scancommands.go index 97bba6a9..dd1ac526 100644 --- a/cli/scancommands.go +++ b/cli/scancommands.go @@ -230,7 +230,10 @@ func validateXrayContext(c *components.Context, serverDetails *coreConfig.Server } func isProjectProvided(c *components.Context) bool { - return c.GetStringFlagValue(flags.Project) != "" || os.Getenv(coreutils.Project) != "" + if c.IsFlagSet(flags.Project) { + return c.GetStringFlagValue(flags.Project) != "" + } + return os.Getenv(coreutils.Project) != "" } func addTrailingSlashToRepoPathIfNeeded(c *components.Context) string {