Skip to content

Commit

Permalink
Address warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Apr 26, 2022
1 parent ac4d767 commit 54109cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/TableStorage/DocumentRepository`1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async Task<T> PutBinaryAsync(T entity, CancellationToken cancellation = default)
var result = await table.UpsertEntityAsync(new BinaryDocumentEntity(partitionKey, rowKey)
{
Document = binarySerializer!.Serialize(entity),
Type = typeof(T).FullName.Replace('+', '.'),
Type = typeof(T).FullName?.Replace('+', '.'),
Version = documentVersion,
MajorVersion = documentMajorVersion,
MinorVersion = documentMinorVersion,
Expand Down Expand Up @@ -236,7 +236,7 @@ async Task<T> PutStringAsync(T entity, CancellationToken cancellation = default)
var result = await table.UpsertEntityAsync(new DocumentEntity(partitionKey, rowKey)
{
Document = stringSerializer!.Serialize(entity),
Type = typeof(T).FullName.Replace('+', '.'),
Type = typeof(T).FullName?.Replace('+', '.'),
Version = documentVersion,
MajorVersion = documentMajorVersion,
MinorVersion = documentMinorVersion,
Expand Down
6 changes: 3 additions & 3 deletions src/TableStorage/Http.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public static HttpRequestMessage AddAuthorizationHeader(this HttpRequestMessage
request.Headers.Add("x-ms-date", date);
}

var resource = request.RequestUri.GetComponents(UriComponents.Path, UriFormat.Unescaped);
var resource = request.RequestUri?.GetComponents(UriComponents.Path, UriFormat.Unescaped);
var toSign = string.Format("{0}\n/{1}/{2}",
request.Headers.GetValues("x-ms-date").First(),
account.Credentials.AccountName,
resource.TrimStart('/'));
resource?.TrimStart('/'));

var hasher = new HMACSHA256(Convert.FromBase64String(account.Credentials.Key));
var hasher = new HMACSHA256(Convert.FromBase64String(account.Credentials.Key ?? ""));
var signature = hasher.ComputeHash(Encoding.UTF8.GetBytes(toSign));
var authentication = new AuthenticationHeaderValue("SharedKeyLite", account.Credentials.AccountName + ":" + Convert.ToBase64String(signature));

Expand Down

0 comments on commit 54109cc

Please sign in to comment.