Skip to content

Commit b745169

Browse files
isasmendiagussschuberth
authored andcommitted
fix(scanoss): snippetFindings use remote file path instead of OSSKB URL
Correct issue where `snippetFindings` location incorrectly used OSSKB URLs instead of remote file paths. Signed-off-by: Agustin Isasmendi <[email protected]>
1 parent f865436 commit b745169

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

plugins/scanners/scanoss/src/main/kotlin/ScanOssResultParser.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private fun getCopyrightFindings(details: ScanFileDetails, path: String): List<C
137137
*/
138138
private fun getSnippets(details: ScanFileDetails): Set<Snippet> {
139139
val matched = requireNotNull(details.matched)
140-
val fileUrl = requireNotNull(details.fileUrl)
140+
val ossFile = requireNotNull(details.file)
141141
val ossLines = requireNotNull(details.ossLines)
142142
val url = requireNotNull(details.url)
143143
val purls = requireNotNull(details.purls)
@@ -147,7 +147,7 @@ private fun getSnippets(details: ScanFileDetails): Set<Snippet> {
147147
.toExpression()?.sorted() ?: SpdxLicenseIdExpression(SpdxConstants.NOASSERTION)
148148

149149
val score = matched.substringBeforeLast("%").toFloat()
150-
val locations = convertLines(fileUrl, ossLines)
150+
val locations = convertLines(ossFile, ossLines)
151151
// TODO: No resolved revision is available. Should a ArtifactProvenance be created instead ?
152152
val vcsInfo = VcsHost.parseUrl(url.takeUnless { it == "none" }.orEmpty())
153153
val provenance = RepositoryProvenance(vcsInfo, ".")

plugins/scanners/scanoss/src/test/kotlin/ScanOssResultParserTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class ScanOssResultParserTest : WordSpec({
121121
Snippet(
122122
98.0f,
123123
TextLocation(
124-
"https://osskb.org/api/file_contents/6ff2427335b985212c9b79dfa795799f",
124+
"src/main/java/com/vdurmont/semver4j/Requirement.java",
125125
1,
126126
710
127127
),

plugins/scanners/scanoss/src/test/kotlin/ScanOssScannerDirectoryTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ScanOssScannerDirectoryTest : StringSpec({
103103
Snippet(
104104
99.0f,
105105
TextLocation(
106-
"https://osskb.org/api/file_contents/871fb0c5188c2f620d9b997e225b0095",
106+
"examples/example.rules.kts",
107107
128,
108108
367
109109
),

0 commit comments

Comments
 (0)