Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 25 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/tinytools-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"
rustix = { version = "1", default-features = false, features = ["fs"] }
serde_json = { workspace = true }
# `curl` reports the SHA-256 of what it downloaded.
sha2 = "0.10"
sha2 = "0.11"
tinytools = { path = "../tinytools", version = "0.5.0" }
# `spawn_blocking` keeps synchronous system DNS resolution off async executor threads;
# `fs`/`process`/`time` serve the filesystem tools.
Expand Down
6 changes: 5 additions & 1 deletion crates/tinytools-std/src/network/curl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::url_guard::{normalize_allowed_domains, validate_url_with_dns_check};
use async_trait::async_trait;
use futures_util::StreamExt;
use sha2::{Digest, Sha256};
use std::fmt::Write as _;
use std::path::{Component, Path, PathBuf};
use std::sync::Arc;
use std::time::Duration;
Expand Down Expand Up @@ -351,7 +352,10 @@ impl Tool for CurlTool {
return Ok(ToolResult::error(format!("Flush failed: {e}")));
}

let sha256 = format!("{:x}", hasher.finalize());
let mut sha256 = String::with_capacity(64);
for byte in hasher.finalize() {
let _ = write!(sha256, "{byte:02x}");
}

tracing::debug!(
target: "[curl]",
Expand Down
Loading