From f378ad87c64c19f89cbd48ba03b1e34a5f26718d Mon Sep 17 00:00:00 2001 From: gauravshinde1729 Date: Sun, 12 Apr 2026 08:20:03 +0530 Subject: [PATCH] fix: display ROOT as "Your Application" in VEX rule path patterns Body: VEX rules created for direct dependencies store a path pattern of ["*", "ROOT", "pkg:..."]. The UI was rendering this literally as "* > ROOT > pkg:..." which was confusing. Strip the leading "*" before ROOT and replace ROOT with "Your Application" so the pattern displays as "Your Application > pkg:...". --- src/components/vex-rules/VexPathPattern.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/components/vex-rules/VexPathPattern.tsx b/src/components/vex-rules/VexPathPattern.tsx index 094bf0c8..6d9fc796 100644 --- a/src/components/vex-rules/VexPathPattern.tsx +++ b/src/components/vex-rules/VexPathPattern.tsx @@ -19,6 +19,7 @@ const PathSegment: FunctionComponent<{ truncate?: boolean; }> = ({ segment, showIcon = false, truncate = false }) => { if (segment === "*") return *; + if (segment === "ROOT") return Your Application; const version = extractVersion(segment); const packageName = beautifyPurl(segment); @@ -42,14 +43,21 @@ const VexPathPattern: FunctionComponent = ({ pathPattern, showTooltip = true, }) => { + // Strip a leading "*" that precedes "ROOT" — the wildcard is redundant for display + // since ROOT already conveys "your application". Renders ["*","ROOT","pkg"] as "Your Application → pkg". + const displayPattern = + pathPattern.length >= 2 && pathPattern[0] === "*" && pathPattern[1] === "ROOT" + ? pathPattern.slice(1) + : pathPattern; + const content = (
- {pathPattern.map((segment, index) => ( + {displayPattern.map((segment, index) => ( - {index < pathPattern.length - 1 && } + {index < displayPattern.length - 1 && } ))}
@@ -64,10 +72,10 @@ const VexPathPattern: FunctionComponent = ({ {content}
- {pathPattern.map((segment, index) => ( + {displayPattern.map((segment, index) => ( - - {index < pathPattern.length - 1 && } + + {index < displayPattern.length - 1 && } ))}