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
4 changes: 4 additions & 0 deletions src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
- Additional information about change #1
-->
## Upcoming Release
* Added a warning message for an upcoming breaking change when getting a single blob
- `Get-AzStorageBlob`
* Fixed the issue of listing blobs with leading slashes
- `Get-AzStorageBlob`
* Added support for sticky bit
- `New-AzDataLakeGen2Item`
- `New-AzDataLakeGen2ACLObject`
Expand Down
4 changes: 3 additions & 1 deletion src/Storage/Storage/Blob/Cmdlet/GetAzureStorageBlob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class GetAzureStorageBlobCommand : StorageCloudBlobCmdletBase
/// </summary>
private const string SingleBlobVersionIDParameterSet = "SingleBlobVersionID";

[CmdletParameterBreakingChange("Blob", ChangeDescription = "Leading and trailing slashes will not be trimmed in a future release.")]
[Parameter(Position = 0, HelpMessage = "Blob name", ParameterSetName = NameParameterSet)]
[Parameter(Position = 0, Mandatory = true, HelpMessage = "Blob name", ParameterSetName = SingleBlobSnapshotTimeParameterSet)]
[Parameter(Position = 0, Mandatory = true, HelpMessage = "Blob name", ParameterSetName = SingleBlobVersionIDParameterSet)]
Expand Down Expand Up @@ -329,6 +330,7 @@ internal async Task ListBlobsByPrefix(long taskId, IStorageBlobManagement localC
{
if (blobFilter == null || blobFilter(item.Name))
{
ClientOptions.TrimBlobNameSlashes = false;
OutputStream.WriteObject(taskId, GetAzureStorageBlob(item, track2container, localChannel.StorageContext, page.ContinuationToken, ClientOptions));
}
realListCount++;
Expand Down Expand Up @@ -387,7 +389,7 @@ internal async Task ListBlobsByPrefix(long taskId, IStorageBlobManagement localC

public static AzureStorageBlob GetAzureStorageBlob(BlobItem blobItem, BlobContainerClient track2container, AzureStorageContext context, string continuationToken = null, BlobClientOptions options = null)
{
BlobBaseClient blobClient = Util.GetTrack2BlobClient(track2container, blobItem.Name, context, blobItem.VersionId, blobItem.IsLatestVersion, blobItem.Snapshot, options, blobItem.Properties.BlobType);
BlobBaseClient blobClient = Util.GetTrack2BlobClient(track2container, blobItem.Name, context, blobItem.VersionId, blobItem.IsLatestVersion, blobItem.Snapshot, options, blobItem.Properties.BlobType, shouldTrimSlash: false);
AzureStorageBlob outputblob = new AzureStorageBlob(blobClient, context, options, blobItem);
if (!string.IsNullOrEmpty(continuationToken))
{
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/Storage/Common/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,10 @@ public static Hashtable GetHashtableFromDictionary(IDictionary<string, string> d
}
}

public static BlobBaseClient GetTrack2BlobClient(BlobContainerClient track2container, string blobName, AzureStorageContext context, string versionId = null, bool? IsCurrentVersion = null, string snapshot = null, BlobClientOptions options = null, global::Azure.Storage.Blobs.Models.BlobType? blobType = null)
public static BlobBaseClient GetTrack2BlobClient(BlobContainerClient track2container, string blobName, AzureStorageContext context, string versionId = null, bool? IsCurrentVersion = null, string snapshot = null, BlobClientOptions options = null, global::Azure.Storage.Blobs.Models.BlobType? blobType = null, bool shouldTrimSlash = true)
{
//Get Track2 Blob Client Uri
BlobUriBuilder blobUriBuilder = new BlobUriBuilder(track2container.Uri)
BlobUriBuilder blobUriBuilder = new BlobUriBuilder(track2container.Uri, trimBlobNameSlashes: shouldTrimSlash)
{
BlobName = blobName
};
Expand Down