Skip to content

Commit

Permalink
fix: install more packages without panics (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub authored Sep 5, 2023
1 parent 46fd143 commit 50022f6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/cli/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async fn internal_fetch(
let cas_paths = download_tarball_to_store(
tarball_cache,
&config.store_dir,
&package_version.dist.integrity,
package_version.dist.integrity.as_ref().expect("has integrity field"),
package_version.dist.unpacked_size,
package_version.as_tarball_url(),
)
Expand Down
4 changes: 2 additions & 2 deletions crates/registry/src/package_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Default, Clone, Eq)]
#[serde(rename_all = "camelCase")]
pub struct PackageDistribution {
pub integrity: String,
pub shasum: String,
pub integrity: Option<String>,
pub shasum: Option<String>,
pub tarball: String,
pub file_count: Option<usize>,
pub unpacked_size: Option<usize>,
Expand Down
2 changes: 1 addition & 1 deletion crates/tarball/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pub async fn download_tarball_to_store(
error,
})?;
let url = package_url.to_string(); // TODO: use Arc
let cas_paths = tokio::task::spawn_blocking(move || {
let cas_paths = tokio::task::spawn(async move {
verify_checksum(&response, package_integrity)
.map_err(|error| VerifyChecksumError { url, error })?;
let data = decompress_gzip(&response, package_unpacked_size)?;
Expand Down

0 comments on commit 50022f6

Please sign in to comment.