alirezanet/Gridify

Already escaped backslash is used to escape more characters

dainis-j opened this issue · 2 comments

Version

2.8.3

Details

When a Gridify filter value ends with an escaped escape character (\\), the already escaped backslash is used to escape another character in certain circumstances.

An example is provided in this gist.

The exception thrown:

Unhandled exception. Gridify.GridifyFilteringException: Unexpected token <End>, expected <CloseParenthesis>
   at Gridify.GridifyExtensions.ApplyFiltering[T](IQueryable`1 query, String filter, IGridifyMapper`1 mapper)
   at Gridify.GridifyExtensions.ApplyFiltering[T](IQueryable`1 query, IGridifyFiltering gridifyFiltering, IGridifyMapper`1 mapper)
   at Program.<Main>$(String[] args) in C:\git\GridifyIssue\Program.cs:line 17

If I replace the filter value with (name=*\\ S), it works correctly, escaping the backslash and filtering the queryable. So I would expect (name=*\\) to work as well without considering the end bracket a value character.

Steps to reproduce

  • Create a GridifyQuery where Filter contains an escaped backslash \\ before a value exit character, e.g., );
  • Apply the filter to a set;
  • Observe the exception.

Hi @dainis-j,
Thank you for the feedback, please try version 2.8.4, it should be fixed now.

Tried out the new version, seems to be working as expected now. Thanks for the quick fix @alirezanet!