From e5849aac4d63b6e695e6004b1edecec44c1882d4 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 9 Jun 2020 08:50:16 +1000 Subject: [PATCH] check full upload return text --- rslib/src/sync/http_client.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rslib/src/sync/http_client.rs b/rslib/src/sync/http_client.rs index a730b9017..7b2ce9f00 100644 --- a/rslib/src/sync/http_client.rs +++ b/rslib/src/sync/http_client.rs @@ -260,8 +260,16 @@ impl HTTPSyncClient { async fn upload_inner(&self, body: Body) -> Result<()> { let data_part = multipart::Part::stream(body); let resp = self.request("upload", data_part, true).await?; - resp.error_for_status()?; - Ok(()) + resp.error_for_status_ref()?; + let text = resp.text().await?; + if text != "OK" { + Err(AnkiError::SyncError { + info: text, + kind: SyncErrorKind::Other, + }) + } else { + Ok(()) + } } pub(crate) async fn upload

(&mut self, col_path: &Path, progress_fn: P) -> Result<()>