The ODataUri.BuildUrl() method fails when a filter looks like this: any() and (condition1 or condition2)
Assemblies affected
OData .Net lib 7.6.0.30305
Reproduce steps
The test case to demonstrate the bug:
public void BuildFilterWithOpenPropertyInsideAnyAndTwoOrs()
{
Uri queryUri = new Uri("People?$filter=MyPaintings%2Fany(p%3Ap%2FOpenProperty) and (ID eq 124) and ((ID eq 125) or (ID eq 126))", UriKind.Relative);
Uri actualUri = UriBuilder(queryUri, ODataUrlKeyDelimiter.Parentheses, settings);
Assert.Equal(new Uri("http://gobbledygook/People?$filter=MyPaintings%2Fany(p%3Ap%2FOpenProperty) and ID eq 124 and (ID eq 125 or ID eq 126)"), actualUri);
}
Expected result
The parentheses at the end of the filter shouldn't be removed. The result is expected to be like this:
http://gobbledygook/People?$filter=MyPaintings/any(p:p/OpenProperty) and ID eq 124 and (ID eq 125 or ID eq 126)
Actual result
All the parentheses are removed which ruins the filter breaking operations priorities.
http://gobbledygook/People?$filter=MyPaintings/any(p:p/OpenProperty) and ID eq 124 and ID eq 125 or ID eq 126
The
ODataUri.BuildUrl()method fails when a filter looks like this:any() and (condition1 or condition2)Assemblies affected
OData .Net lib 7.6.0.30305
Reproduce steps
The test case to demonstrate the bug:
Expected result
The parentheses at the end of the filter shouldn't be removed. The result is expected to be like this:
http://gobbledygook/People?$filter=MyPaintings/any(p:p/OpenProperty) and ID eq 124 and (ID eq 125 or ID eq 126)Actual result
All the parentheses are removed which ruins the filter breaking operations priorities.
http://gobbledygook/People?$filter=MyPaintings/any(p:p/OpenProperty) and ID eq 124 and ID eq 125 or ID eq 126