Azure / azure-cli

Azure Command-Line Interface
MIT License
3.91k stars 2.88k forks source link

az storage blob download has strange name parsing issues #26899

Open Zhaph opened 11 months ago

Zhaph commented 11 months ago

Describe the bug

When attempting to download specific files from blob storage, the command fails with the error <partialfilename> was unexpected at this time.

For example the following file name is parsed successfully: az storage blob download -n "Sitecore/10.2.0/Sitecore 10.2.0 rev. 006766 (XM) (Cloud)_cd.scwdp.zip"

While replacing the spaces with underscores: az storage blob download -n "Sitecore/10.2.0/Sitecore_10.2.0_rev.006766_(XM)_(Cloud)_cm-fixed.scwdp.zip" Results in: _(Cloud)_cm-fixed.scwdp.zip was unexpected at this time.

Replacing the underscores with hyphens results in the similar message.

Replacing the underscore after rev.006766 with a space successfully attempts to download the file.

Related command

az storage blob download

Errors

was unexpected at this time ### Issue script & Debug output ``` az storage blob download -n "Sitecore/10.2.0/Sitecore-10.2.0-rev.006766-(XM)-(Cloud)-cm-fixed.scwdp.zip" --blob-endpoint $blobEndpoint --account-key $storageKey -c $containerName -f "Sitecore.cm.scwdp.zip" -o none --debug -(Cloud)-cm-fixed.scwdp.zip was unexpected at this time. C:\prj\testing> "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\\..\python.exe" -IBm azure.cli storage blob download -n Sitecore/10.2.0/Sitecore-10.2.0-rev.006766-(XM)-(Cloud)-cm-fixed.scwdp.zip --blob-endpoint --account-key redacted> -c redacted> -f Sitecore.cm.scwdp.zip -o none --debug ``` ### Expected behavior File is successfully downloaded from blob storage. ### Environment Summary azure-cli 2.49.0 * core 2.49.0 * telemetry 1.0.8 Extensions: front-door 1.0.17 ssh 1.1.3 Dependencies: msal 1.20.0 azure-mgmt-resource 22.0.0 Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' Extensions directory 'C:\Users\...\.azure\cliextensions' Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:05:00) [MSC v.1929 32 bit (Intel)] ### Additional context _No response_
azure-client-tools-bot-prd[bot] commented 11 months ago

Hi @Zhaph,

2.49.0 is not the latest Azure CLI(2.50.0).

Please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

yonzhan commented 11 months ago

Thank you for opening this issue, we will look into it.

Zhaph commented 11 months ago

Just upgraded to: azure-cli 2.50.0

core 2.50.0

And I can confirm the behaviour is the same.

Note - this occurs before any attempt is made to connect to the storage account, so you don't really need to supply valid creds/paths to test.

calvinhzy commented 9 months ago

Hi @Zhaph, was not able to reproduce this issue, can you show the files inside portal and their names, is this inside an hierarchical name space storage account that supports directories? image image image image