Skip to content

Commit 705e2b2

Browse files
committed
🐛 Link java dependencies that don't have a sha
Resolves: #1982 In some analysis cases, java dependencies may be generated with the full `name` (group id + artifact id) and `version` but lack a `sha` value. When this occurs, a maven central search string can still be created. Now, for any java dependency, link to maven central: - Use the dependencies `sha`, or - Use the `name` and `version` Signed-off-by: Scott J Dickerson <[email protected]>
1 parent 153ae06 commit 705e2b2

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

client/src/app/pages/dependencies/dependency-apps-table.tsx

+14-4
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,21 @@ const DependencyVersionColumn = ({
285285
}: {
286286
appDependency: AnalysisAppDependency;
287287
}) => {
288-
const isJavaDependency = name && version && sha && provider === "java";
288+
let mavenCentralLink;
289289

290-
const mavenCentralLink = isJavaDependency
291-
? `https://search.maven.org/search?q=1:${extractFirstSha(sha)}`
292-
: undefined;
290+
if (name && version && provider === "java") {
291+
if (sha) {
292+
mavenCentralLink = `https://search.maven.org/#search|1:${extractFirstSha(
293+
sha
294+
)}`;
295+
} else {
296+
const group = name.substring(0, name.lastIndexOf("."));
297+
const artifact = name.substring(name.lastIndexOf(".") + 1);
298+
mavenCentralLink = encodeURI(
299+
`https://search.maven.org/#search|g:${group} a:${artifact} v:${version}`
300+
);
301+
}
302+
}
293303

294304
return (
295305
<TextContent>

0 commit comments

Comments
 (0)