Unnecessary UrlDecode in BlobFileStore creates IFileStoreEntry with incorrect name.
Describe the bug
BlobFileStore is doing an unnecessary UrlDecode on blob.Name which doesn't work for file names such as "My+File.jpg".
When I look at the blob.Name during runtime it's not url encoded at all so this call appears unnecessary.
Orchard Core version
Latest https://github.com/OrchardCMS/OrchardCore/blob/95c8445ce48f3903f7c9906c785c9517e3c8967f/src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs#L170
To Reproduce
- Upload a file into Azure Blob storage with a + character in it's filename. (ex: "My+File.jpg")
- Call GetDirectoryContentAsync method on the BlobFileStore.
Expected behavior
Returned IFileStoreEntry should have the name My+File.jpg, but instead will have name "My File.jpg". If you try to use this IFileStoreEntry name for anything it won't match what's actually in the blob storage.
I'm considering just removing the URL decode call completely, but I assume it's here for a reason? Wondering if it could be a change in the Azure SDK behavior?
It does suspiciously look like some Azure SDK behavior or something changed, because I'm sure it wasn't just a wild idea to put that decode there. The Blob Storage API is a web API, after all, with blobs being HTTP-accessible resources, so doing URL encoding for their names at one point looks necessary. And in some form it has been there since the very beginning: https://github.com/OrchardCMS/OrchardCore/pull/1186. Here's a second instance of it: https://github.com/OrchardCMS/OrchardCore/blob/95c8445ce48f3903f7c9906c785c9517e3c8967f/src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs#L147
I'm not sure, though it does look that these should be removed. However, using such files from the Media Library would still be broken, because open the file's from the View link there still yields a 404, not even reaching https://github.com/OrchardCMS/OrchardCore/blob/95c8445ce48f3903f7c9906c785c9517e3c8967f/src/OrchardCore/OrchardCore.FileStorage.AzureBlob/BlobFileStore.cs#L61 When the decoding is there, that'll be reached, i.e. the file attempted to be loaded (what will fail, even if the path there is encoded). So maybe that's why we need this, but still, the file loading needs to be fixed.
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).
This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.
Same or related? https://github.com/OrchardCMS/OrchardCore/issues/17985