diff --git a/Minio/ApiEndpoints/BucketOperations.cs b/Minio/ApiEndpoints/BucketOperations.cs index fde8904fa..68260ffd5 100644 --- a/Minio/ApiEndpoints/BucketOperations.cs +++ b/Minio/ApiEndpoints/BucketOperations.cs @@ -159,16 +159,33 @@ public partial class MinioClient : IBucketOperations foreach (Item item in result.Item2) { lastItem = item; - item.Key = HttpUtility.UrlDecode(item.Key); + if (result.Item1.EncodingType == "url") + { + item.Key = HttpUtility.UrlDecode(item.Key); + } obs.OnNext(item); } if (result.Item1.NextMarker != null) { - marker = HttpUtility.UrlDecode(result.Item1.NextMarker); + if (result.Item1.EncodingType == "url") + { + marker = HttpUtility.UrlDecode(result.Item1.NextMarker); + } + else + { + marker = result.Item1.NextMarker; + } } else if (lastItem != null) { - marker = HttpUtility.UrlDecode(lastItem.Key); + if (result.Item1.EncodingType == "url") + { + marker = HttpUtility.UrlDecode(lastItem.Key); + } + else + { + marker = lastItem.Key; + } } isRunning = result.Item1.IsTruncated; cts.Token.ThrowIfCancellationRequested(); diff --git a/Minio/DataModel/ListBucketResult.cs b/Minio/DataModel/ListBucketResult.cs index 15822b37c..c897d7d1c 100644 --- a/Minio/DataModel/ListBucketResult.cs +++ b/Minio/DataModel/ListBucketResult.cs @@ -32,5 +32,6 @@ public class ListBucketResult public string MaxKeys { get; set; } public string Delimiter { get; set; } public bool IsTruncated { get; set; } + public string EncodingType { get; set; } } }