Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: copy error on non-ascii file path for cos/obs/wasabi services #2948

Merged
merged 8 commits into from
Aug 26, 2023
2 changes: 1 addition & 1 deletion core/src/services/cos/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;

Expand Down
2 changes: 1 addition & 1 deletion core/src/services/obs/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;

Expand Down
2 changes: 1 addition & 1 deletion core/src/services/wasabi/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;

Expand Down
8 changes: 4 additions & 4 deletions core/tests/behavior/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();

Expand All @@ -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";
Expand Down