Skip to content

Commit 70ab2cf

Browse files
Merge pull request #12 from Checkmarx/miryamFoifer/supportMultiLocations
Support Multi Locations (AST-105014)
2 parents 975b8cf + 1f5bef0 commit 70ab2cf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/imagesExtractor/images_utils.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func mergeDuplicates(imageModels []types.ImageModel) []types.ImageModel {
2929
for _, location := range img.ImageLocations {
3030
found := false
3131
for _, existingLocation := range aggregated[img.Name] {
32-
if existingLocation.Origin == location.Origin && existingLocation.Path == location.Path {
32+
if isSameLocation(location, existingLocation) {
3333
found = true
3434
break
3535
}
@@ -51,3 +51,9 @@ func mergeDuplicates(imageModels []types.ImageModel) []types.ImageModel {
5151

5252
return result
5353
}
54+
55+
func isSameLocation(loc1, loc2 types.ImageLocation) bool {
56+
return loc1.Origin == loc2.Origin && loc1.Path == loc2.Path &&
57+
loc1.FinalStage == loc2.FinalStage && loc1.Line == loc2.Line &&
58+
loc1.StartIndex == loc2.StartIndex && loc1.EndIndex == loc2.EndIndex
59+
}

0 commit comments

Comments
 (0)