From 99e3b1c7543bc533845f2ed0661d7e47ab13e657 Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Fri, 2 Feb 2024 10:19:25 +0100 Subject: [PATCH] refactor(conan): Pass also the hash algorithm The hash algorithm is known, so pass it to `create()` so that determining the algorithm is not needed. Signed-off-by: Frank Viernau --- plugins/package-managers/conan/src/main/kotlin/Conan.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/package-managers/conan/src/main/kotlin/Conan.kt b/plugins/package-managers/conan/src/main/kotlin/Conan.kt index 0dd0931f9c672..a7a2752f5e38e 100644 --- a/plugins/package-managers/conan/src/main/kotlin/Conan.kt +++ b/plugins/package-managers/conan/src/main/kotlin/Conan.kt @@ -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 @@ -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 {