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 && →} ))}