From 10e371394dcb8d69c653d903a2727baa9c3e18e2 Mon Sep 17 00:00:00 2001 From: Jacob Turner Date: Tue, 28 May 2024 15:10:56 +0200 Subject: [PATCH] Update crates/sdk/src/migrations.rs Co-authored-by: Tomas Zemanovic --- crates/sdk/src/migrations.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/sdk/src/migrations.rs b/crates/sdk/src/migrations.rs index 964e16c7be..07c915129a 100644 --- a/crates/sdk/src/migrations.rs +++ b/crates/sdk/src/migrations.rs @@ -401,13 +401,9 @@ where } fn validate(&self) -> eyre::Result { - let mut update_json = String::new(); - let mut file = std::fs::File::open(&self.path).map_err(|_| { - eyre!("Could not fine updates file at the specified path.") + let update_json = std::fs::read_to_string(&self.path).map_err(|_| { + eyre!("Could not find or read updates file at the specified path.") })?; - _ = file - .read_to_string(&mut update_json) - .map_err(|e| eyre!("{}", e))?; // validate contents against provided hash if Hash::sha256(update_json.as_bytes()) != self.hash { Err(eyre!(