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

Fixes incomplete uploads due to properties mismatch #719

Merged
merged 2 commits into from
Sep 1, 2023
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/Microsoft.Graph.Core/Microsoft.Graph.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<VersionPrefix>3.0.10</VersionPrefix>
<VersionPrefix>3.0.11</VersionPrefix>
<VersionSuffix></VersionSuffix>
<PackageReleaseNotes>
- Fixes a bug where BatchRequestContentCollection.NewBatchWithFailedRequests would fail when more than 20 requests had been sent.
- Fixes a bug where large file uploads would not complete due to different cased properties.
</PackageReleaseNotes>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.Graph.Core/Models/UploadSession.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------

Expand Down Expand Up @@ -39,7 +39,7 @@ internal class UploadSession : IUploadSession
/// </summary>
public IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
{
return new Dictionary<string, Action<IParseNode>>
return new Dictionary<string, Action<IParseNode>> (StringComparer.OrdinalIgnoreCase)
{
{"expirationDateTime", (n) => { ExpirationDateTime = n.GetDateTimeOffsetValue(); } },
{"nextExpectedRanges", (n) => { NextExpectedRanges = n.GetCollectionOfPrimitiveValues<string>().ToList(); } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,30 @@ public void SerializeUploadSessionValues()
// Expect the string to be ISO 8601-1:2019 format
Assert.Equal(expectedString, serializedJsonString);
}

[Fact]
public void DeserializeUploadSessionValues()
{
// Act 1
const string camelCasedPayload = @"{""expirationDateTime"":""2016-11-20T18:23:45.9356913+00:00"",""nextExpectedRanges"":[""0 - 1000""],""uploadUrl"":""http://localhost""}";
var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(camelCasedPayload));
var parseNode = this.parseNodeFactory.GetRootParseNode(CoreConstants.MimeTypeNames.Application.Json, memoryStream);
var uploadSession = parseNode.GetObjectValue(UploadSession.CreateFromDiscriminatorValue);
Assert.NotNull(uploadSession);
Assert.NotNull(uploadSession.ExpirationDateTime);
Assert.NotNull(uploadSession.NextExpectedRanges);
Assert.Single(uploadSession.NextExpectedRanges);

// Act 1
const string pascalCasedPayload = @"{""ExpirationDateTime"":""2016-11-20T18:23:45.9356913+00:00"",""NextExpectedRanges"":[""0 - 1000""],""uploadUrl"":""http://localhost""}";
var memoryStream2 = new MemoryStream(Encoding.UTF8.GetBytes(pascalCasedPayload));
var parseNode2 = this.parseNodeFactory.GetRootParseNode(CoreConstants.MimeTypeNames.Application.Json, memoryStream2);
var uploadSession2 = parseNode2.GetObjectValue(UploadSession.CreateFromDiscriminatorValue);
Assert.NotNull(uploadSession2);
Assert.NotNull(uploadSession2.ExpirationDateTime);
Assert.NotNull(uploadSession2.NextExpectedRanges);
Assert.Single(uploadSession2.NextExpectedRanges);
}

[Fact]
public void SerializeServiceExceptionValues()
Expand Down
Loading