This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 96a630711 refactor(services/dropbox): Use OpWrite instead of passing
all args as parameters (#3126)
96a630711 is described below
commit 96a6307112270141175c027cc2fe5fb9e663cbf7
Author: Bryan <[email protected]>
AuthorDate: Tue Sep 19 01:21:47 2023 +0800
refactor(services/dropbox): Use OpWrite instead of passing all args as
parameters (#3126)
---
core/src/services/dropbox/core.rs | 8 ++++----
core/src/services/dropbox/writer.rs | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/core/src/services/dropbox/core.rs
b/core/src/services/dropbox/core.rs
index 4b3fba758..885747573 100644
--- a/core/src/services/dropbox/core.rs
+++ b/core/src/services/dropbox/core.rs
@@ -98,11 +98,11 @@ impl DropboxCore {
&self,
path: &str,
size: Option<usize>,
- content_type: Option<&str>,
+ args: &OpWrite,
body: AsyncBody,
) -> Result<Response<IncomingAsyncBody>> {
let url = "https://content.dropboxapi.com/2/files/upload".to_string();
- let args = DropboxUploadArgs {
+ let dropbox_update_args = DropboxUploadArgs {
path: build_rooted_abs_path(&self.root, path),
..Default::default()
};
@@ -112,13 +112,13 @@ impl DropboxCore {
}
request_builder = request_builder.header(
CONTENT_TYPE,
- content_type.unwrap_or("application/octet-stream"),
+ args.content_type().unwrap_or("application/octet-stream"),
);
let mut request = request_builder
.header(
"Dropbox-API-Arg",
-
serde_json::to_string(&args).map_err(new_json_serialize_error)?,
+
serde_json::to_string(&dropbox_update_args).map_err(new_json_serialize_error)?,
)
.body(body)
.map_err(new_request_build_error)?;
diff --git a/core/src/services/dropbox/writer.rs
b/core/src/services/dropbox/writer.rs
index b5a4a69af..e8fdd998f 100644
--- a/core/src/services/dropbox/writer.rs
+++ b/core/src/services/dropbox/writer.rs
@@ -47,7 +47,7 @@ impl oio::OneShotWrite for DropboxWriter {
.dropbox_update(
&self.path,
Some(bs.len()),
- self.op.content_type(),
+ &self.op,
AsyncBody::ChunkedBytes(bs),
)
.await?;