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 d4f9c615e fix: copy error on non-ascii file path for cos/obs/wasabi 
services (#2948)
d4f9c615e is described below

commit d4f9c615eb3bbc272aa92051417cf3829d4e319d
Author: Bo Wu <[email protected]>
AuthorDate: Sat Aug 26 19:28:18 2023 +0800

    fix: copy error on non-ascii file path for cos/obs/wasabi services (#2948)
---
 core/src/services/cos/core.rs    | 2 +-
 core/src/services/obs/core.rs    | 2 +-
 core/src/services/wasabi/core.rs | 2 +-
 core/tests/behavior/copy.rs      | 8 ++++----
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/core/src/services/cos/core.rs b/core/src/services/cos/core.rs
index 490dada6e..fa6bfe99e 100644
--- a/core/src/services/cos/core.rs
+++ b/core/src/services/cos/core.rs
@@ -284,7 +284,7 @@ impl CosCore {
         let url = format!("{}/{}", self.endpoint, 
percent_encode_path(&target));
 
         let mut req = Request::put(&url)
-            .header("x-cos-copy-source", percent_encode_path(&source))
+            .header("x-cos-copy-source", &source)
             .body(AsyncBody::Empty)
             .map_err(new_request_build_error)?;
 
diff --git a/core/src/services/obs/core.rs b/core/src/services/obs/core.rs
index 3d8ba1daf..e78bafce6 100644
--- a/core/src/services/obs/core.rs
+++ b/core/src/services/obs/core.rs
@@ -284,7 +284,7 @@ impl ObsCore {
         let url = format!("{}/{}", self.endpoint, 
percent_encode_path(&target));
 
         let mut req = Request::put(&url)
-            .header("x-obs-copy-source", percent_encode_path(&source))
+            .header("x-obs-copy-source", &source)
             .body(AsyncBody::Empty)
             .map_err(new_request_build_error)?;
 
diff --git a/core/src/services/wasabi/core.rs b/core/src/services/wasabi/core.rs
index 0a074d492..23506c260 100644
--- a/core/src/services/wasabi/core.rs
+++ b/core/src/services/wasabi/core.rs
@@ -418,7 +418,7 @@ impl WasabiCore {
         }
 
         let mut req = req
-            .header(constants::X_AMZ_COPY_SOURCE, percent_encode_path(&source))
+            .header(constants::X_AMZ_COPY_SOURCE, &source)
             .body(AsyncBody::Empty)
             .map_err(new_request_build_error)?;
 
diff --git a/core/tests/behavior/copy.rs b/core/tests/behavior/copy.rs
index 2178ce30d..b8a4573ba 100644
--- a/core/tests/behavior/copy.rs
+++ b/core/tests/behavior/copy.rs
@@ -28,7 +28,7 @@ pub fn behavior_copy_tests(op: &Operator) -> Vec<Trial> {
 
     async_trials!(
         op,
-        test_copy_file,
+        test_copy_file_with_ascii_name,
         test_copy_file_with_non_ascii_name,
         test_copy_non_existing_source,
         test_copy_source_dir,
@@ -39,8 +39,8 @@ pub fn behavior_copy_tests(op: &Operator) -> Vec<Trial> {
     )
 }
 
-/// Copy a file and test with stat.
-pub async fn test_copy_file(op: Operator) -> Result<()> {
+/// Copy a file with ascii name and test contents.
+pub async fn test_copy_file_with_ascii_name(op: Operator) -> Result<()> {
     let source_path = uuid::Uuid::new_v4().to_string();
     let (source_content, _) = gen_bytes();
 
@@ -58,7 +58,7 @@ pub async fn test_copy_file(op: Operator) -> Result<()> {
     Ok(())
 }
 
-/// Copy a file and test with stat.
+/// Copy a file with non ascii name and test contents.
 pub async fn test_copy_file_with_non_ascii_name(op: Operator) -> Result<()> {
     let source_path = "🐂🍺中文.docx";
     let target_path = "😈🐅Français.docx";

Reply via email to