mirror of
https://github.com/ankitects/anki.git
synced 2025-12-12 22:36:55 -05:00
check full upload return text
This commit is contained in:
parent
b277849db1
commit
e5849aac4d
1 changed files with 10 additions and 2 deletions
|
|
@ -260,8 +260,16 @@ impl HTTPSyncClient {
|
||||||
async fn upload_inner(&self, body: Body) -> Result<()> {
|
async fn upload_inner(&self, body: Body) -> Result<()> {
|
||||||
let data_part = multipart::Part::stream(body);
|
let data_part = multipart::Part::stream(body);
|
||||||
let resp = self.request("upload", data_part, true).await?;
|
let resp = self.request("upload", data_part, true).await?;
|
||||||
resp.error_for_status()?;
|
resp.error_for_status_ref()?;
|
||||||
Ok(())
|
let text = resp.text().await?;
|
||||||
|
if text != "OK" {
|
||||||
|
Err(AnkiError::SyncError {
|
||||||
|
info: text,
|
||||||
|
kind: SyncErrorKind::Other,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn upload<P>(&mut self, col_path: &Path, progress_fn: P) -> Result<()>
|
pub(crate) async fn upload<P>(&mut self, col_path: &Path, progress_fn: P) -> Result<()>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue