bugfix: proper handing of whitespace char in url with Form-decoding instead of Percent-decoding (#178)
This commit is contained in:
@@ -19,19 +19,20 @@ use minio::s3::response::{CopyObjectResponse, PutObjectContentResponse, StatObje
|
||||
use minio::s3::types::S3Api;
|
||||
use minio_common::rand_src::RandSrc;
|
||||
use minio_common::test_context::TestContext;
|
||||
use minio_common::utils::rand_object_name;
|
||||
|
||||
#[minio_macros::test(skip_if_express)]
|
||||
async fn copy_object(ctx: TestContext, bucket_name: String) {
|
||||
let object_name_src: String = rand_object_name();
|
||||
let object_name_dst: String = rand_object_name();
|
||||
use minio_common::utils::rand_object_name_utf8;
|
||||
|
||||
async fn test_copy_object(
|
||||
ctx: &TestContext,
|
||||
bucket_name: &str,
|
||||
object_name_src: &str,
|
||||
object_name_dst: &str,
|
||||
) {
|
||||
let size = 16_u64;
|
||||
let content = ObjectContent::new_from_stream(RandSrc::new(size), Some(size));
|
||||
|
||||
let resp: PutObjectContentResponse = ctx
|
||||
.client
|
||||
.put_object_content(&bucket_name, &object_name_src, content)
|
||||
.put_object_content(bucket_name, object_name_src, content)
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -40,8 +41,8 @@ async fn copy_object(ctx: TestContext, bucket_name: String) {
|
||||
|
||||
let resp: CopyObjectResponse = ctx
|
||||
.client
|
||||
.copy_object(&bucket_name, &object_name_dst)
|
||||
.source(CopySource::new(&bucket_name, &object_name_src).unwrap())
|
||||
.copy_object(bucket_name, object_name_dst)
|
||||
.source(CopySource::new(bucket_name, object_name_src).unwrap())
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -50,10 +51,28 @@ async fn copy_object(ctx: TestContext, bucket_name: String) {
|
||||
|
||||
let resp: StatObjectResponse = ctx
|
||||
.client
|
||||
.stat_object(&bucket_name, &object_name_dst)
|
||||
.stat_object(bucket_name, object_name_dst)
|
||||
.send()
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(resp.size().unwrap(), size);
|
||||
assert_eq!(resp.bucket(), bucket_name);
|
||||
}
|
||||
|
||||
/// Test copying an object with a name that contains utf8 characters.
|
||||
#[minio_macros::test(skip_if_express)]
|
||||
async fn copy_object_1(ctx: TestContext, bucket_name: String) {
|
||||
test_copy_object(
|
||||
&ctx,
|
||||
&bucket_name,
|
||||
&rand_object_name_utf8(20),
|
||||
&rand_object_name_utf8(20),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
/// Test copying an object with a name that contains white space characters.
|
||||
#[minio_macros::test(skip_if_express)]
|
||||
async fn copy_object_2(ctx: TestContext, bucket_name: String) {
|
||||
test_copy_object(&ctx, &bucket_name, "a b+c", "a b+c2").await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user