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

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

Open
DonavanPrinsTrimble opened this issue Aug 27, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@DonavanPrinsTrimble
Copy link

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.

@DonavanPrinsTrimble DonavanPrinsTrimble added the bug Something isn't working label Aug 27, 2024
@DonavanPrinsTrimble
Copy link
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()))

@alirezanet alirezanet added enhancement New feature or request and removed bug Something isn't working labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants