fix: Fix upload command not returning

pull/2838/head
Matthew Richardson 6 days ago
parent 24b75a9ee9
commit 5645abe9e4
No known key found for this signature in database
GPG Key ID: 94F48D0A011CC828

@ -74,7 +74,7 @@ async fn download(
) -> Result<()> { ) -> Result<()> {
let url = url.to_string(); let url = url.to_string();
let file_path = file_path.to_string(); let file_path = file_path.to_string();
tokio::spawn(async move { tokio::spawn(async move {
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let mut request = if let Some(body) = body { let mut request = if let Some(body) = body {
@ -115,7 +115,7 @@ async fn download(
Ok(()) Ok(())
}) })
.await .await
.map_err(|e| Error::Io(std::io::Error::new(std::io::ErrorKind::Other, e.to_string())))? .map_err(|e| Error::Io(std::io::Error::other(e.to_string())))?
} }
#[command] #[command]
@ -127,7 +127,7 @@ async fn upload(
) -> Result<String> { ) -> Result<String> {
let url = url.to_string(); let url = url.to_string();
let file_path = file_path.to_string(); let file_path = file_path.to_string();
tokio::spawn(async move { tokio::spawn(async move {
// Read the file // Read the file
let file = File::open(&file_path).await?; let file = File::open(&file_path).await?;
@ -157,7 +157,7 @@ async fn upload(
} }
}) })
.await .await
.map_err(|e| Error::Io(std::io::Error::new(std::io::ErrorKind::Other, e.to_string())))? .map_err(|e| Error::Io(std::io::Error::other(e.to_string())))?
} }
fn file_to_body(channel: Channel<ProgressPayload>, file: File, file_len: u64) -> reqwest::Body { fn file_to_body(channel: Channel<ProgressPayload>, file: File, file_len: u64) -> reqwest::Body {

Loading…
Cancel
Save