Skip to content

Commit 644bf35

Browse files
Merge pull request #284 from MordechaiHadad/fix/nightly-nonsense
Fix nightly nonsense
2 parents 906964f + 7bb9341 commit 644bf35

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/handlers/install_handler.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::process::Stdio;
1717
use tokio::fs::File;
1818
use tokio::io::AsyncWriteExt;
1919
use tokio::{fs, process::Command};
20-
use tracing::info;
20+
use tracing::{info, warn};
2121
use yansi::Paint;
2222

2323
use super::{InstallResult, PostDownloadVersionType};
@@ -136,13 +136,12 @@ pub async fn start(
136136
} else {
137137
let downloaded_checksum =
138138
download_version(client, version, root, &config.config, true).await?;
139+
let archive_path = root.join(format!(
140+
"{}.{}",
141+
downloaded_archive.file_name, downloaded_archive.file_format
142+
));
139143

140144
if let PostDownloadVersionType::Standard(downloaded_checksum) = downloaded_checksum {
141-
let archive_path = root.join(format!(
142-
"{}.{}",
143-
downloaded_archive.file_name, downloaded_archive.file_format
144-
));
145-
146145
let checksum_path = root.join(format!(
147146
"{}.{}",
148147
downloaded_checksum.file_name, downloaded_checksum.file_format
@@ -163,6 +162,9 @@ pub async fn start(
163162
info!("Checksum matched!");
164163
tokio::fs::remove_file(checksum_path).await?;
165164
unarchive::start(downloaded_archive).await?
165+
} else if let PostDownloadVersionType::None = downloaded_checksum {
166+
warn!("No checksum provided, skipping checksum verification");
167+
unarchive::start(downloaded_archive).await?
166168
}
167169
}
168170
}
@@ -409,6 +411,9 @@ async fn download_version(
409411
semver: version.semver.clone(),
410412
}))
411413
} else {
414+
if get_sha256sum {
415+
return Ok(PostDownloadVersionType::None);
416+
}
412417
let error_text = response.text().await?;
413418
if error_text.contains("Not Found") {
414419
Err(anyhow!(

src/handlers/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub enum InstallResult {
3333
/// * `None` - No specific version type is assigned.
3434
/// * `Standard(LocalVersion)` - The version is a standard version. The `LocalVersion` contains the details of the version.
3535
/// * `Hash` - The version is identified by a hash.
36-
#[derive(PartialEq)]
36+
#[derive(PartialEq, Debug)]
3737
pub enum PostDownloadVersionType {
3838
None,
3939
Standard(LocalVersion),

src/helpers/version/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub struct LocalNightly {
114114
/// };
115115
/// println!("The local version is {:?}", local_version);
116116
/// ```
117-
#[derive(Clone, PartialEq)]
117+
#[derive(Clone, PartialEq, Debug)]
118118
pub struct LocalVersion {
119119
pub file_name: String,
120120
pub file_format: String,

0 commit comments

Comments
 (0)