diff --git a/src/Microsoft.AspNetCore.JsonPatch/Internal/PathHelpers.cs b/src/Microsoft.AspNetCore.JsonPatch/Internal/PathHelpers.cs index 7ef8fe7baf..d46314c148 100644 --- a/src/Microsoft.AspNetCore.JsonPatch/Internal/PathHelpers.cs +++ b/src/Microsoft.AspNetCore.JsonPatch/Internal/PathHelpers.cs @@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.JsonPatch.Internal // absolutely necessary, but it allows us to already catch mistakes // on creation of the patch document rather than on execute. - if (path.Contains(".") || path.Contains("//") || path.Contains(" ") || path.Contains("\\")) + if (path.Contains("//") || path.Contains(" ") || path.Contains("\\")) { throw new JsonPatchException(Resources.FormatInvalidValueForPath(path), null); } diff --git a/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentTest.cs b/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentTest.cs index 6b44b6696c..197e514cee 100644 --- a/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentTest.cs +++ b/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentTest.cs @@ -45,24 +45,6 @@ namespace Microsoft.AspNetCore.JsonPatch exception.Message); } - [Fact] - public void InvalidPathWithDotShouldThrowException() - { - // Arrange - var patchDocument = new JsonPatchDocument(); - - // Act - var exception = Assert.Throws(() => - { - patchDocument.Add("NewInt.Test", 1); - }); - - // Assert - Assert.Equal( - "The provided string 'NewInt.Test' is an invalid path.", - exception.Message); - } - [Fact] public void NonGenericPatchDocToGenericMustSerialize() { @@ -177,4 +159,4 @@ namespace Microsoft.AspNetCore.JsonPatch Assert.Equal("The JSON patch document was malformed and could not be parsed.", exception.Message); } } -} \ No newline at end of file +}