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
3 changes: 1 addition & 2 deletions sdk/storage/Azure.Storage.Blobs.Batch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
- Added support for service version 2020-10-02.
- TenantId can now be discovered through the service challenge response, when using a TokenCredential for authorization.
- A new property is now available on the ClientOptions called `EnableTenantDiscovery`. If set to true, the client will attempt an initial unauthorized request to the service to prompt a challenge containing the tenantId hint.

- This release contains bug fixes to improve quality.
- Fixed bug where blob name was not encoded properly when using batch operations.

## 12.6.0 (2021-06-08)
- Includes all features from 12.6.0-beta.4.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<Compile Include="$(AzureStorageSharedSources)Errors.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureStorageSharedSources)Errors.Clients.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureStorageSharedSources)StorageClientDiagnostics.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureStorageSharedSources)StorageExtensions.cs" LinkBase="Shared" />
<Compile Include="$(AzureStorageSharedSources)StorageExceptionExtensions.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
<Compile Include="$(AzureStorageSharedSources)StorageVersionExtensions.cs" Link="Shared\%(RecursiveDir)\%(Filename)%(Extension)" />
</ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions sdk/storage/Azure.Storage.Blobs.Batch/src/BlobBatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Azure.Storage.Blobs.Batch;
using Azure.Storage.Blobs.Batch.Models;
using Azure.Storage.Blobs.Models;
using Azure.Storage.Shared;

namespace Azure.Storage.Blobs.Specialized
{
Expand Down Expand Up @@ -195,7 +196,7 @@ public virtual Response DeleteBlob(

HttpMessage message = BlobRestClient.CreateDeleteRequest(
containerName: blobContainerName,
blob: blobName,
blob: blobName.EscapePath(),
timeout: null,
leaseId: conditions?.LeaseId,
deleteSnapshots: snapshotsOption == DeleteSnapshotsOption.None ? null : (DeleteSnapshotsOptionType?)snapshotsOption,
Expand Down Expand Up @@ -310,7 +311,7 @@ public virtual Response SetBlobAccessTier(

HttpMessage message = BlobRestClient.CreateSetAccessTierRequest(
containerName: blobContainerName,
blob: blobName,
blob: blobName.EscapePath(),
accessTier.ToBatchAccessTier(),
timeout: null,
rehydratePriority: rehydratePriority.ToBatchRehydratePriority(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,28 @@ public async Task Delete_Basic()
await scenario.AssertDeleted(blobs);
}

[RecordedTest]
public async Task Delete_SpecialCharacters()
{
await using TestScenario scenario = Scenario();
BlobClient[] blobs = await scenario.CreateBlobsAsync(3, prefix: "blob ąęó");

BlobBatchClient client = scenario.GetBlobBatchClient();

using BlobBatch batch = client.CreateBatch();
Response[] responses = new Response[]
{
batch.DeleteBlob(blobs[0].Uri),
batch.DeleteBlob(blobs[1].Uri),
batch.DeleteBlob(blobs[2].Uri)
};
Response response = await client.SubmitBatchAsync(batch);

scenario.AssertStatus(202, response);
scenario.AssertStatus(202, responses);
await scenario.AssertDeleted(blobs);
}

[RecordedTest]
[ServiceVersion(Min = BlobClientOptions.ServiceVersion.V2019_12_12)]
public async Task Delete_Basic_AccountSas()
Expand Down Expand Up @@ -585,6 +607,27 @@ public async Task SetBlobAccessTier_Basic()
await scenario.AssertTiers(AccessTier.Cool, blobs);
}

[RecordedTest]
public async Task SetBlobAccessTier_SpecialCharacters()
{
await using TestScenario scenario = Scenario();
BlobClient[] blobs = await scenario.CreateBlobsAsync(3, prefix: "blob ąęó");

BlobBatchClient client = scenario.GetBlobBatchClient();
using BlobBatch batch = client.CreateBatch();
Response[] responses = new Response[]
{
batch.SetBlobAccessTier(blobs[0].Uri, AccessTier.Cool),
batch.SetBlobAccessTier(blobs[1].Uri, AccessTier.Cool),
batch.SetBlobAccessTier(blobs[2].Uri, AccessTier.Cool)
};
Response response = await client.SubmitBatchAsync(batch);

scenario.AssertStatus(202, response);
scenario.AssertStatus(200, responses);
await scenario.AssertTiers(AccessTier.Cool, blobs);
}

[Test]
[ServiceVersion(Min = BlobClientOptions.ServiceVersion.V2019_12_12)]
[LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/18058
Expand Down Expand Up @@ -1007,12 +1050,12 @@ public async Task<BlobContainerClient> CreateContainerAsync()
return test.Container;
}

public async Task<BlobClient[]> CreateBlobsAsync(BlobContainerClient container, int count)
public async Task<BlobClient[]> CreateBlobsAsync(BlobContainerClient container, int count, string prefix="blob")
{
BlobClient[] blobs = new BlobClient[count];
for (int i = 0; i < count; i++)
{
blobs[i] = _test.InstrumentClient(container.GetBlobClient("blob" + (++_blobId)));
blobs[i] = _test.InstrumentClient(container.GetBlobClient(prefix + (++_blobId)));
await blobs[i].UploadAsync(BinaryData.FromBytes(_test.GetRandomBuffer(Constants.KB)));
}
return blobs;
Expand All @@ -1029,8 +1072,8 @@ public async Task<BlockBlobClient[]> CreateBlockBlobsAsync(BlobContainerClient c
return blobs;
}

public async Task<BlobClient[]> CreateBlobsAsync(int count) =>
await CreateBlobsAsync(await CreateContainerAsync(), count);
public async Task<BlobClient[]> CreateBlobsAsync(int count, string prefix="blob") =>
await CreateBlobsAsync(await CreateContainerAsync(), count, prefix);

public async Task<BlockBlobClient[]> CreateBlockBlobsAsync(int count) =>
await CreateBlockBlobsAsync(await CreateContainerAsync(), count);
Expand Down
Loading