Remove leading slashes from top manifests
This commit is contained in:
@@ -153,28 +153,31 @@ export default class ComponentDetection {
|
||||
private static addPackagesToManifests(packages: Array<ComponentDetectionPackage>, manifests: Array<Manifest>, dependencyGraphs: DependencyGraphs): void {
|
||||
packages.forEach((pkg: ComponentDetectionPackage) => {
|
||||
pkg.locationsFoundAt.forEach((location: any) => {
|
||||
if (!manifests.find((manifest: Manifest) => manifest.name == location)) {
|
||||
const manifest = new Manifest(location, location);
|
||||
// Use the normalized path (remove leading slash if present)
|
||||
const normalizedLocation = location.startsWith('/') ? location.substring(1) : location;
|
||||
|
||||
if (!manifests.find((manifest: Manifest) => manifest.name == normalizedLocation)) {
|
||||
const manifest = new Manifest(normalizedLocation, normalizedLocation);
|
||||
manifests.push(manifest);
|
||||
}
|
||||
|
||||
const depGraphEntry = dependencyGraphs[location];
|
||||
const depGraphEntry = dependencyGraphs[normalizedLocation];
|
||||
if (!depGraphEntry) {
|
||||
core.warning(`No dependency graph entry found for manifest location: ${location}`);
|
||||
core.warning(`No dependency graph entry found for manifest location: ${normalizedLocation}`);
|
||||
return; // Skip this location if not found in dependencyGraphs
|
||||
}
|
||||
|
||||
const directDependencies = depGraphEntry.explicitlyReferencedComponentIds;
|
||||
if (directDependencies.includes(pkg.id)) {
|
||||
manifests
|
||||
.find((manifest: Manifest) => manifest.name == location)
|
||||
.find((manifest: Manifest) => manifest.name == normalizedLocation)
|
||||
?.addDirectDependency(
|
||||
pkg,
|
||||
ComponentDetection.getDependencyScope(pkg)
|
||||
);
|
||||
} else {
|
||||
manifests
|
||||
.find((manifest: Manifest) => manifest.name == location)
|
||||
.find((manifest: Manifest) => manifest.name == normalizedLocation)
|
||||
?.addIndirectDependency(
|
||||
pkg,
|
||||
ComponentDetection.getDependencyScope(pkg)
|
||||
|
||||
Reference in New Issue
Block a user