SimpleS3 icon indicating copy to clipboard operation
SimpleS3 copied to clipboard

ListObject* with encoding-type set to "url" produces infinite loop.

Open LordMike opened this issue 7 months ago • 0 comments

Describe the bug I'm experimenting with encoding-type set to url as AWS docs mention an issue with a lack of encoding on their part (non-xml safe characters in object keys).

I tried enumerating versions on a bucket with some test objects, and encountered an infinite loop in SimpleS3.

How to reproduce? I created this test bucket listing:

$ aws s3 ls s3://aa-alpha-bucket/ --recursive
2025-03-19 14:29:11          9 a%20.txt
2025-03-19 14:29:11          9 a&1.txt
2025-03-19 14:29:11          9 a(1).txt
2025-03-19 14:29:12          9 a.txt
2025-03-19 14:29:20          0 folder1/
2025-03-19 14:29:33          9 folder1/a%20.txt
2025-03-19 14:29:27          0 folder1/folder2/
// Nuget Genbox.SimpleS3.AmazonS3, v. 3.2.9
var client = new AmazonS3Client("key", "secret", AmazonS3Region.UsEast1, new NetworkConfig
{
    Proxy = new WebProxy("http://127.0.0.1:8888")
});
var objects = await client.ListAllObjectVersionsAsync("aa-alpha-bucket", request =>
{
    // To force multiple pages
    request.MaxKeys = 2;
    request.EncodingType = EncodingType.Url;
}).ToListAsync();

Console.WriteLine(objects.Count);

When run, my proxy shows that this url is requested repeatedly.

https://aa-alpha-bucket.s3.us-east-1.amazonaws.com/?versions&encoding-type=url&key-marker=a%25281%2529.txt&max-keys=2

I expect this is an issue with double url-encoding.

Expected behavior Handling of url encoding-type.

LordMike avatar Mar 19 '25 14:03 LordMike