Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ function Test-Blob
Assert-AreEqual $t.Error $null
Assert-AreEqual (Get-FileHash -Path $localDestFile2 -Algorithm MD5).Hash (Get-FileHash -Path $localSrcFile -Algorithm MD5).Hash

# upload/download blob which name include "/"
$blobNameWithFolder = "aa/bb/cc/dd.txt"
$localFileNameWithFolder= "aa\bb\cc\dd.txt"
Set-AzStorageBlobContent -File $localSrcFile -Container $containerName -Blob $blobNameWithFolder -Force -Context $storageContext
Get-AzStorageBlobContent -Container $containerName -Blob $blobNameWithFolder -Destination . -Force -Context $storageContext
Assert-AreEqual (Get-FileHash -Path $localFileNameWithFolder -Algorithm MD5).Hash (Get-FileHash -Path $localSrcFile -Algorithm MD5).Hash
Remove-Item -Path "aa" -Force -Recurse
Remove-AzStorageBlob -Container $containerName -Blob $blobNameWithFolder -Force -Context $storageContext

Remove-AzStorageBlob -Container $containerName -Blob $objectName2 -Force -Context $storageContext
$blob = Get-AzStorageBlob -Container $containerName -Context $storageContext
Assert-AreEqual $blob.Count 1
Expand Down
2 changes: 2 additions & 0 deletions src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* Supported blob query acceleration
- `Get-AzStorageBlobQueryResult`
- `New-AzStorageBlobQueryConfig`
* Fixed [#12592]: Fix download blob fail when related sub directory not exist.
- `Get-AzStorageBlobContent`

## Version 2.4.0
* Supported create container/blob Sas token with new permission x,t
Expand Down
6 changes: 3 additions & 3 deletions src/Storage/Storage/Blob/Cmdlet/GetAzureStorageBlobContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,23 +218,23 @@ internal void GetBlobContent(CloudBlobContainer container, string blobName, stri
throw new ArgumentException(String.Format(Resources.InvalidBlobName, blobName));
}

string filePath = GetFullReceiveFilePath(fileName, blobName, null);
// Don't need get File full path here, since will get file full path in GetBlobContent() with blob object.

ValidatePipelineCloudBlobContainer(container);

if (UseTrack2Sdk())
{
BlobContainerClient track2container = AzureStorageContainer.GetTrack2BlobContainerClient(container, Channel.StorageContext, ClientOptions);
BlobBaseClient blobClient = track2container.GetBlobBaseClient(blobName);
GetBlobContent(blobClient, filePath, true);
GetBlobContent(blobClient, fileName, true);
}
else
{
AccessCondition accessCondition = null;
BlobRequestOptions requestOptions = RequestOptions;
CloudBlob blob = GetBlobReferenceFromServerWithContainer(Channel, container, blobName, accessCondition, requestOptions, OperationContext);

GetBlobContent(blob, filePath, true);
GetBlobContent(blob, fileName, true);
}
}

Expand Down