languages: Fix digest check on downloaded artifact for clangd (#35870)

Closes 35864

Release Notes:

- N/A
This commit is contained in:
Lukas Wirth 2025-08-08 15:54:26 +02:00 committed by GitHub
parent 2526dcb5a5
commit d5c4e4b7b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -75,6 +75,9 @@ impl super::LspAdapter for CLspAdapter {
&*version.downcast::<GitHubLspBinaryVersion>().unwrap();
let version_dir = container_dir.join(format!("clangd_{name}"));
let binary_path = version_dir.join("bin/clangd");
let expected_digest = digest
.as_ref()
.and_then(|digest| digest.strip_prefix("sha256:"));
let binary = LanguageServerBinary {
path: binary_path.clone(),
@ -99,7 +102,9 @@ impl super::LspAdapter for CLspAdapter {
log::warn!("Unable to run {binary_path:?} asset, redownloading: {err}",)
})
};
if let (Some(actual_digest), Some(expected_digest)) = (&metadata.digest, digest) {
if let (Some(actual_digest), Some(expected_digest)) =
(&metadata.digest, expected_digest)
{
if actual_digest == expected_digest {
if validity_check().await.is_ok() {
return Ok(binary);