Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address warnings #90

Merged
merged 1 commit into from
Apr 26, 2022
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
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