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

Parse failures with special characters in untyped data #938

Closed
mikepizzo opened this issue Mar 10, 2017 · 1 comment
Closed

Parse failures with special characters in untyped data #938

mikepizzo opened this issue Mar 10, 2017 · 1 comment

Comments

@mikepizzo
Copy link
Member

Attempting to deserialize an untyped string containing special characters fails.

Assemblies affected

WebAPI 6.x, ODataClient

Reproduce steps

string requestUri = baseUri + "/entityset";
string payload = "{\"stringProperty\":\"[t@xt'',,][']other::]mo}{retext\"}";
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Patch, requestUri);
request.Content = new StringContent(payload);
request.Content.Headers.Add("Content-Type","application/json");

HttpResponseMessage response = this.Client.SendAsync(request).Result;
string result = response.Content.ReadAsStringAsync().Result;

Expected result

string would be deserialized successfully

Actual result

Exception is thrown that string is invalid format.

Additional details

As of ODataLib V7, String/numeric data in a JSON Payload that isn't described by metadata or @odata.type is now read as an ODataUntypedValue. WebAPI and ODataClient attempt to parse this value using ODataUriUtils, but that code doesn't properly ignore special characters inside double-quotes (it expects single quotes, as in a URI) and thus fails if the string property contains properties such as brackets, commas, or braces.

@mikepizzo
Copy link
Member Author

Fixed by PR #936

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant