Skip to content

Commit

Permalink
fix(SBOMER-321): Normalize deliverables URL in operation generation
Browse files Browse the repository at this point in the history
  • Loading branch information
janinko committed Feb 3, 2025
1 parent 8ae7057 commit 7dc95f9
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.jboss.sbomer.cli.feature.sbom.command;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -111,7 +112,15 @@ protected Path doGenerate() {
throw new ApplicationException("Unable to create a new Bom");
}

String deliverableUrl = config.getDeliverableUrls().get(getParent().getIndex());
String deliverableUrl;
try {
String url = config.getDeliverableUrls().get(getParent().getIndex());
deliverableUrl = URI.create(url).normalize().toURL().toString();
} catch (MalformedURLException e) {
String url = config.getDeliverableUrls().get(getParent().getIndex());
throw new ApplicationException("Could not parse deliverable URL " + url, e);
}

log.info(
"Generating CycloneDX compliant SBOM for the deliverable: {}, with index: {}, with the provided config: {}",
deliverableUrl,
Expand Down

0 comments on commit 7dc95f9

Please sign in to comment.