'Upgrading Azure Blob API 11->12, leading slash in blob name cannot be found in 12
My project was built long ago using Microsoft.Azure.Storage.Blob and I have many containers with many files. I am not sure how it happened but all of my folder structures have a leading slash in them. This has not been an issue until I try to upgrade my code to Azure.Blobs (v12).
When I look at my blobs in the Azure Portal, it shows a blank / in the root folder, and browsing down I see it looks like this
[container] / / [first folder] / [second folder] / [filename]
Azure portal has not problem showing a file and downloading it. When I look at properties, the URL looks like https://[account].blob.core.windows.net/[container]//folder1/folder2/file.ext
After updating my code, I find that container.GetBlobClient([folder+filename]) will not retrieve any files. It always gets a 404. When I look in debugger to see what URL it is trying to access, it is eliminating the double slash so it looks like https://[account].blob.core.windows.net/[container]/folder1/folder2/file.ext
I have tried prepending a slash to the [folder+filename] but it always strips it out. Ditto for prepending two slashes.
I have been googling all day and cannot find an answer here. Is there a workaround to this? I am thinking there has to be because both the Azure Portal and Cloudberry Explorer can access and download my blobs.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
