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
2 changes: 1 addition & 1 deletion sdk/storage/Azure.Storage.Files.Shares/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Release History

## 12.5.0-preview.2 (Unreleased)
- Fixed bug where ShareDirectoryClient.Exists() and ShareFileClient.Exists() would thrown an exception when the directory or file's parent directory didn't exist.
- Fixed bug where ShareDirectoryClient.Exists(), .DeleteIfExists() and ShareFileClient.Exists(), .DeleteIfExists() would thrown an exception when the directory or file's parent directory didn't exist.
- Renamed ShareClient.SetTier() -> ShareClient.SetProperties(). SetProperties() can be used to set both Share Tier and Share Quota.
- Changed ShareDeleteOptions.IncludeSnapshots -> .ShareSnapshotsDeleteOption, and added option to also delete Share Snapshots that have been leased.
- Added additional info to exception messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,8 @@ internal async Task<Response<bool>> DeleteIfExistsInternal(
}
catch (RequestFailedException storageRequestFailedException)
when (storageRequestFailedException.ErrorCode == ShareErrorCode.ResourceNotFound
|| storageRequestFailedException.ErrorCode == ShareErrorCode.ShareNotFound)
|| storageRequestFailedException.ErrorCode == ShareErrorCode.ShareNotFound
|| storageRequestFailedException.ErrorCode == ShareErrorCode.ParentNotFound)
{
return Response.FromValue(false, default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,8 @@ private async Task<Response<bool>> DeleteIfExistsInternal(
}
catch (RequestFailedException storageRequestFailedException)
when (storageRequestFailedException.ErrorCode == ShareErrorCode.ResourceNotFound
|| storageRequestFailedException.ErrorCode == ShareErrorCode.ShareNotFound)
|| storageRequestFailedException.ErrorCode == ShareErrorCode.ShareNotFound
|| storageRequestFailedException.ErrorCode == ShareErrorCode.ParentNotFound)
{
return Response.FromValue(false, default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,21 @@ public async Task DeleteIfExists_ShareNotExists()
Assert.IsFalse(response.Value);
}

[Test]
public async Task DeleteIfExists_ParentDirectoryNotExists()
{
// Arrange
await using DisposingShare test = await GetTestShareAsync();
ShareDirectoryClient parentDirectory = InstrumentClient(test.Share.GetDirectoryClient(GetNewDirectoryName()));
ShareDirectoryClient directory = InstrumentClient(parentDirectory.GetSubdirectoryClient(GetNewDirectoryName()));

// Act
Response<bool> response = await directory.DeleteIfExistsAsync();

// Assert
Assert.IsFalse(response.Value);
}

[Test]
public async Task DeleteIfExists_Error()
{
Expand Down
15 changes: 15 additions & 0 deletions sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,21 @@ public async Task DeleteIfExistsAsync_ShareNotExists()
Assert.IsFalse(response.Value);
}

[Test]
public async Task DeleteIfExistsAsync_ParentDirectoryNotExists()
{
// Arrange
await using DisposingShare test = await GetTestShareAsync();
ShareDirectoryClient parentDirectory = InstrumentClient(test.Share.GetDirectoryClient(GetNewDirectoryName()));
ShareFileClient file = InstrumentClient(parentDirectory.GetFileClient(GetNewFileName()));

// Act
Response<bool> response = await file.DeleteIfExistsAsync();

// Assert
Assert.IsFalse(response.Value);
}

[Test]
public async Task DeleteIfExistsAsync_Error()
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading