test(s3): cover signed equals object reads (#2598)

This commit is contained in:
安正超
2026-04-19 10:11:16 +08:00
committed by GitHub
parent 457f4e0170
commit 1d1f00470d

View File

@@ -333,6 +333,44 @@ mod tests {
Ok(())
}
#[tokio::test]
#[serial]
async fn test_signed_get_existing_object_with_trailing_equals_returns_content() -> Result<(), Box<dyn Error + Send + Sync>> {
init_logging();
let mut env = RustFSTestEnvironment::new().await?;
env.start_rustfs_server(vec![]).await?;
let client = create_s3_client(&env);
let bucket = "test-existing-equals-key";
create_bucket(&client, bucket).await?;
let key = "path/sitemap.xmlage=";
let content = b"object content for raw signed URL with trailing equals";
client
.put_object()
.bucket(bucket)
.key(key)
.body(ByteStream::from_static(content))
.send()
.await?;
let url = format!("{}/{}/{}", env.url, bucket, key);
let response = signed_get(&url, &env.access_key, &env.secret_key).await?;
assert_eq!(
response.status(),
StatusCode::OK,
"existing object key ending with '=' should pass signature validation and return content"
);
let body = response.bytes().await?;
assert_eq!(body.as_ref(), content);
env.stop_server();
Ok(())
}
/// Test DELETE operation with special characters
#[tokio::test]
#[serial]