fix encryption context (#4582)

This commit is contained in:
microzchang 2023-04-27 10:56:03 +08:00 committed by GitHub
parent 4d898ffa59
commit cfa652182d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -211,9 +211,12 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
ret.Details.EncryptionKeySha256 = std::move(response.Value.Details.EncryptionKeySha256);
ret.Details.EncryptionScope = std::move(response.Value.Details.EncryptionScope);
ret.Details.IsServerEncrypted = response.Value.Details.IsServerEncrypted;
ret.Details.EncryptionContext
= Azure::Core::Http::_internal::HttpShared::GetHeaderOrEmptyString(
response.RawResponse->GetHeaders(), _detail::EncryptionContextHeaderName);
auto& headers = response.RawResponse->GetHeaders();
auto encryptionContext = headers.find(_detail::EncryptionContextHeaderName);
if (encryptionContext != headers.end())
{
ret.Details.EncryptionContext = encryptionContext->second;
}
return Azure::Response<Models::DownloadFileResult>(
std::move(ret), std::move(response.RawResponse));
}

View File

@ -342,8 +342,12 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
ret.VersionId = std::move(response.Value.VersionId);
ret.IsCurrentVersion = std::move(response.Value.IsCurrentVersion);
ret.IsDirectory = _detail::MetadataIncidatesIsDirectory(ret.Metadata);
ret.EncryptionContext = Azure::Core::Http::_internal::HttpShared::GetHeaderOrEmptyString(
response.RawResponse->GetHeaders(), _detail::EncryptionContextHeaderName);
auto& headers = response.RawResponse->GetHeaders();
auto encryptionContext = headers.find(_detail::EncryptionContextHeaderName);
if (encryptionContext != headers.end())
{
ret.EncryptionContext = encryptionContext->second;
}
return Azure::Response<Models::PathProperties>(std::move(ret), std::move(response.RawResponse));
}