Skip to content

Commit a223a1a

Browse files
nnobelissschuberth
authored andcommitted
fix(fossid-webapp): Make Snippet url property non-nullable
This is a follow-up of the discussion at [1]: Since FossID does not document the data model of the API response, the `url` property of the `Snippet` has been conservatively made nullable. Since then, FossID support confirmed that a null URL will never be exposed via the API response. [1]: #6791 (comment) Signed-off-by: Nicolas Nobelis <[email protected]>
1 parent 48da67a commit a223a1a

File tree

2 files changed

+3
-5
lines changed
  • clients/fossid-webapp/src/main/kotlin/model/result
  • scanner/src/main/kotlin/scanners/fossid

2 files changed

+3
-5
lines changed

clients/fossid-webapp/src/main/kotlin/model/result/Snippet.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ data class Snippet(
3838

3939
val file: String,
4040
val fileLicense: String?,
41-
val url: String?,
41+
val url: String,
4242
val hits: String,
4343
val size: Int?,
4444

scanner/src/main/kotlin/scanners/fossid/FossId.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -822,10 +822,8 @@ class FossId internal constructor(
822822

823823
// FossID does not return the hash of the remote artifact. Instead, it returns the MD5 hash of the
824824
// matched file in the remote artifact as part of the "match_file_id" property.
825-
val snippetProvenance = it.url?.let { url ->
826-
ArtifactProvenance(RemoteArtifact(url, Hash.NONE))
827-
} ?: UnknownProvenance
828-
val purlType = it.url?.let { url -> urlToPackageType(url).toString() }
825+
val snippetProvenance = ArtifactProvenance(RemoteArtifact(it.url, Hash.NONE))
826+
val purlType = urlToPackageType(it.url).toString()
829827

830828
// TODO: FossID doesn't return the line numbers of the match, only the character range. One must use
831829
// another call "getMatchedLine" to retrieve the matched line numbers. Unfortunately, this is a

0 commit comments

Comments
 (0)