From 3c48d71cc61b3abd76462d2a1050341acb3dc104 Mon Sep 17 00:00:00 2001 From: egibs <20933572+egibs@users.noreply.github.com> Date: Wed, 22 May 2024 16:05:08 -0500 Subject: [PATCH] Ignore empty root strings when choosing output format Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> --- pkg/action/scan.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/action/scan.go b/pkg/action/scan.go index f3d4cec79..77dbbecd2 100644 --- a/pkg/action/scan.go +++ b/pkg/action/scan.go @@ -93,7 +93,7 @@ func scanSinglePath(ctx context.Context, c Config, yrs *yara.Rules, path string, // If absPath is provided, use it instead of the path if they are different. // This is useful when scanning images and archives. - if absPath != "" && absPath != path { + if absPath != "" && absPath != path && root != "" { fr.Path = fmt.Sprintf("%s ∴ %s", absPath, formatPath(cleanPath(path, root))) }