Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlobContainerClient.StartDownloadToDirectoryAsync url-encodes subdirectories containing spaces. #315

Open
lardogbeck opened this issue Feb 16, 2024 · 0 comments

Comments

@lardogbeck
Copy link

Which service(blob, file) does this issue concern?

Blob

Which version of the SDK was used?

<PackageVersion Include="Azure.Storage.Blobs" Version="12.20.0-beta.1" />
<PackageVersion Include="Azure.Storage.Files.Shares" Version="12.12.1" />
<PackageVersion Include="Azure.Storage.Queues" Version="12.12.0" />
<PackageVersion Include="Azure.Storage.DataMovement" Version="12.0.0-beta.4" />
<PackageVersion Include="Azure.Storage.DataMovement.Blobs" Version="12.0.0-beta.4" />

On which platform were you using? (.Net Framework version or .Net Core version, and OS version)

.NET 6

How can the problem be reproduced? It'd be better if the code caused the problem can be shared.

Create a blob name in path format containing spaces, e.g. 20348.1.x64.fe_release.210507-1500_server_serverstandard_en-us_vl/Virtual Hard Disks/20348.1.amd64fre.fe_release.210507-1500_server_serverstandard_en-us_vl.vhd

Then execute the following to download it from the container with prefix 20348.1.x64.fe_release.210507-1500_server_serverstandard_en-us_vl

             BlobContainerClientTransferOptions blobContainerClientTransferOptions = new BlobContainerClientTransferOptions()
            {
                BlobContainerOptions = new BlobStorageResourceContainerOptions()
                {
                    BlobDirectoryPrefix = blobPrefix,
                    BlobType = BlobType.Block,
                },
                TransferOptions = new DataTransferOptions()
                {
                    CreationPreference = overwrite ? StorageResourceCreationPreference.OverwriteIfExists : StorageResourceCreationPreference.FailIfExists,
                },
            };

            DataTransfer dataTransfer = await blobContainerClient.StartDownloadToDirectoryAsync(destPath, blobContainerClientTransferOptions).ConfigureAwait(false);

            await dataTransfer.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);

What problem was encountered?

Expect the blob name segment "Virtual Hard Disks" to appear as subdir "Virtual Hard Disks". Instead it appears URL encoded as "Virtual%20Hard%20Disks".

Have you found a mitigation/solution?

Nothing other than making a rename pass after the download. Can't remove the spaces in this case because Hyper-V expects these directory names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant