Skip to content

Filter value with leading space gets trimmed resulting in no match #208

Description

@DonavanPrinsTrimble

Version

2.14.2

Details

When I give Gridify a filter value with a leading space the resulting query trims the filter criteria resulting in no matches being found.

Granted I should sanitize my data, but I still believe this to be a bug.

Steps to reproduce

When I give Gridify the filter value: "tags= with leading space", it generates the following query statement:
SELECT VALUE root FROM root JOIN (SELECT VALUE EXISTS(SELECT VALUE m0 FROM root JOIN m0 IN root["tags"] WHERE (m0["name"] = "leading space"))) AS v0 WHERE ((root["tags"] != null) AND v0)

Note that the filter criteria no longer contains the leading space, resulting in no matches returned from my store.

Activity

  1. DonavanPrinsTrimble commented on Sep 3, 2024

    @DonavanPrinsTrimble
    Author

    For what it's worth, I worked around the issue by modifying my filter mapper:

    new GridifyMapper<MyModel>()
    	.GenerateMappings()
    	.AddMap(nameof(Filter.Tags), t => t.Tags.Select(tag =>  tag.Name.TrimStart()))
  2. added
    enhancementNew feature or request
    and removed
    bugSomething isn't working
    on Oct 31, 2024
  3. alirezanet commented on Dec 30, 2024

    @alirezanet
    Owner

    Hi @DonavanPrinsTrimble,
    just FYI another workaround is escaping the leading space

    tags=\ with leading space
    

    also would be nice if I get some feedback about a potential configuration to disable the AutoTrim feature. do you think would be useful in your case?

  4. aritma-sondr3 commented on Sep 8, 2026

    @aritma-sondr3

    We were just bit by this, we'll work around it for now with the workaround mentioned above but having this be configurable would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions