From b958ed12ae15ee681f1c208b6962bd3d558134cc Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Wed, 25 Aug 2021 21:01:40 +1000 Subject: [PATCH 4/4] Cargo.toml: Update isahc Update isahc. As part of this we need to convert copy_to_file() to not be async due to: https://github.com/sagebind/isahc/issues/283 Signed-off-by: Alistair Francis --- Cargo.lock | 30 +++++++++++++++++++++++++++--- Cargo.toml | 2 +- src/models/preview_image.rs | 4 ++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 42f21e6..ec3602a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1413,7 +1413,7 @@ dependencies = [ "deadpool", "futures", "http-types", - "isahc", + "isahc 0.9.14", "js-sys", "log", "wasm-bindgen", @@ -1494,13 +1494,37 @@ dependencies = [ "crossbeam-utils", "curl", "curl-sys", - "encoding_rs", "flume", "futures-lite", "http", "log", + "once_cell", + "slab", + "sluice", + "tracing", + "tracing-futures", + "url", + "waker-fn", +] + +[[package]] +name = "isahc" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "431445cb4ba85a80cb1438a9ae8042dadb78ae4046ecee89ad027b614aa0ddb7" +dependencies = [ + "async-channel", + "crossbeam-utils", + "curl", + "curl-sys", + "encoding_rs", + "event-listener", + "futures-lite", + "http", + "log", "mime", "once_cell", + "polling", "slab", "sluice", "tracing", @@ -2461,7 +2485,7 @@ dependencies = [ "gtk-macros", "html2pango", "http-client", - "isahc", + "isahc 1.5.0", "lazy_static", "libhandy", "log", diff --git a/Cargo.toml b/Cargo.toml index 51e5850..ed29a18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ pretty_env_logger = "0.4" diesel = { version = "1.4", features = ["sqlite", "r2d2", "chrono"] } diesel_migrations = { version = "1.4", features = ["sqlite"] } anyhow = "1.0" -isahc = "0.9" +isahc = "1.5" sanitize_html = "0.7" regex = "1.5" secret-service = "1.0" diff --git a/src/models/preview_image.rs b/src/models/preview_image.rs index 3b9b7c4..b9900e7 100644 --- a/src/models/preview_image.rs +++ b/src/models/preview_image.rs @@ -1,7 +1,7 @@ use anyhow::Result; use crypto::digest::Digest; use crypto::sha1::Sha1; -use isahc::ResponseExt; +use isahc::prelude::*; use std::path::PathBuf; use std::rc::Rc; use url::Url; @@ -33,7 +33,7 @@ impl PreviewImage { } pub async fn download(&self, client: Rc) -> Result<()> { - if let Ok(mut resp) = client.get_async(&self.url.to_string()).await { + if let Ok(mut resp) = client.get(&self.url.to_string()) { info!("Downloading preview image {} into {:#?}", self.url, self.cache); resp.copy_to_file(self.cache.clone())?; } -- 2.31.1