Skip to content

Commit

Permalink
Fix Share Client failure #4377 (#4381)
Browse files Browse the repository at this point in the history
* Fix Share Client failure #4377
  • Loading branch information
microzchang authored and antkmsft committed Apr 5, 2023
1 parent d6dad60 commit e5b353c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sdk/storage/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "cpp",
"TagPrefix": "cpp/storage",
"Tag": "cpp/storage_925cef0316"
"Tag": "cpp/storage_92d8f38118"
}
12 changes: 9 additions & 3 deletions sdk/storage/azure-storage-files-shares/src/rest_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1652,9 +1652,15 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
}
}
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
response.LastModified = DateTime::Parse(
pRawResponse->GetHeaders().at("Last-Modified"), Azure::DateTime::DateFormat::Rfc1123);
if (pRawResponse->GetHeaders().count("ETag") != 0)
{
response.ETag = ETag(pRawResponse->GetHeaders().at("ETag"));
}
if (pRawResponse->GetHeaders().count("Last-Modified") != 0)
{
response.LastModified = DateTime::Parse(
pRawResponse->GetHeaders().at("Last-Modified"), Azure::DateTime::DateFormat::Rfc1123);
}
return Response<Models::ShareStatistics>(std::move(response), std::move(pRawResponse));
}
Response<Models::CreateDirectoryResult> DirectoryClient::Create(
Expand Down
4 changes: 4 additions & 0 deletions sdk/storage/azure-storage-files-shares/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ directive:
- from: swagger-document
where: $["x-ms-paths"]["/{shareName}?restype=share&comp=stats"].get.responses["200"]
transform: >
$.headers["ETag"]["x-ms-client-default"] = "";
$.headers["ETag"]["x-nullable"] = true;
$.headers["Last-Modified"]["x-ms-client-default"] = "";
$.headers["Last-Modified"]["x-nullable"] = true;
$.schema = {
"description": "Stats for the share.",
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ namespace Azure { namespace Storage { namespace Test {
}
}

TEST_F(FileShareClientTest, GetStatistics) { EXPECT_NO_THROW(m_shareClient->GetStatistics()); }

TEST_F(FileShareClientTest, PremiumShare)
{
auto shareClientOptions = InitStorageClientOptions<Files::Shares::ShareClientOptions>();
Expand Down

0 comments on commit e5b353c

Please sign in to comment.