I have bunch of blobs on azure storage which follow name in following pattern: <someName>_DateTimeOffset.UtcNow
. When I fetch the blobs using container.ListBlobs()
the blob Uri looks like this: <someName>__11%252f3%252f2014+10%253a00%253a00+PM+%252b00%253a00+%252b00%253a00
.
If you look closely, %25
becomes %
when encoded once and %2f
becomes :
. So it looks like the Uri goes through double encoding.
When I try to get hold of this blob, it doesn't work. Here is the code snippet:
BlobResultSegment resultSegment = await container.ListBlobsSegmentedAsync("myPrefix", true, BlobListingDetails.All, 10, null, null, null);
var list = resultSegment.Results.Select(x => x.Uri.ToString().Split('/').Last());
var blob = container.GetBlockBlobReference(blobName);
blob.FetchAttributes();
foreach (var element in list)
{
var blob = container.GetBlockBlobReference(element);
blob.FetchAttributes();
var t = blob.Metadata;
}
Any Idea how do I encode the URL before trying to access it?
Note: I use latest azure storage library