diff --git a/core/src/services/onedrive/backend.rs b/core/src/services/onedrive/backend.rs index 0001d8685bae..0a7952e4a27f 100644 --- a/core/src/services/onedrive/backend.rs +++ b/core/src/services/onedrive/backend.rs @@ -257,7 +257,7 @@ impl OnedriveBackend { &self, path: &str, size: Option, - content_type: Option<&str>, + args: &OpWrite, body: AsyncBody, ) -> Result> { let url = format!( @@ -274,7 +274,7 @@ impl OnedriveBackend { req = req.header(header::CONTENT_LENGTH, size) } - if let Some(mime) = content_type { + if let Some(mime) = args.content_type() { req = req.header(header::CONTENT_TYPE, mime) } @@ -286,7 +286,7 @@ impl OnedriveBackend { pub(crate) async fn onedrive_chunked_upload( &self, url: &str, - content_type: Option<&str>, + args: &OpWrite, offset: usize, chunk_end: usize, total_len: usize, @@ -303,7 +303,7 @@ impl OnedriveBackend { let size = chunk_end - offset + 1; req = req.header(header::CONTENT_LENGTH, size.to_string()); - if let Some(mime) = content_type { + if let Some(mime) = args.content_type() { req = req.header(header::CONTENT_TYPE, mime) } diff --git a/core/src/services/onedrive/writer.rs b/core/src/services/onedrive/writer.rs index 326035acbaba..f6ee5e96986b 100644 --- a/core/src/services/onedrive/writer.rs +++ b/core/src/services/onedrive/writer.rs @@ -64,12 +64,7 @@ impl OneDriveWriter { async fn write_simple(&self, bs: Bytes) -> Result<()> { let resp = self .backend - .onedrive_upload_simple( - &self.path, - Some(bs.len()), - self.op.content_type(), - AsyncBody::Bytes(bs), - ) + .onedrive_upload_simple(&self.path, Some(bs.len()), &self.op, AsyncBody::Bytes(bs)) .await?; let status = resp.status(); @@ -109,7 +104,7 @@ impl OneDriveWriter { .backend .onedrive_chunked_upload( &session_response.upload_url, - None, + &OpWrite::default(), offset, chunk_end, total_len,