Skip to content

Commit

Permalink
refactor(conan): Pass also the hash algorithm
Browse files Browse the repository at this point in the history
The hash algorithm is known, so pass it to `create()` so that
determining the algorithm is not needed.

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau committed Feb 2, 2024
1 parent 56a81a5 commit 99e3b1c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/package-managers/conan/src/main/kotlin/Conan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import org.ossreviewtoolkit.analyzer.parseAuthorString
import org.ossreviewtoolkit.downloader.VcsHost
import org.ossreviewtoolkit.downloader.VersionControlSystem
import org.ossreviewtoolkit.model.Hash
import org.ossreviewtoolkit.model.HashAlgorithm
import org.ossreviewtoolkit.model.Identifier
import org.ossreviewtoolkit.model.Package
import org.ossreviewtoolkit.model.PackageReference
Expand Down Expand Up @@ -415,7 +416,7 @@ class Conan(
val url = artifactEntry["url"].let { urlNode ->
(urlNode.takeIf { it.isTextual } ?: urlNode.first()).textValueOrEmpty()
}
val hash = Hash.create(artifactEntry["sha256"].textValueOrEmpty())
val hash = Hash.create(artifactEntry["sha256"].textValueOrEmpty(), HashAlgorithm.SHA256.name)

RemoteArtifact(url, hash)
}.getOrElse {
Expand Down

0 comments on commit 99e3b1c

Please sign in to comment.