Skip to content

Fix literal wildcards in text filters#4609

Draft
floze-the-genius wants to merge 1 commit into
MerginMaps:masterfrom
floze-the-genius:bugfix/text-filter-literal-wildcards
Draft

Fix literal wildcards in text filters#4609
floze-the-genius wants to merge 1 commit into
MerginMaps:masterfrom
floze-the-genius:bugfix/text-filter-literal-wildcards

Conversation

@floze-the-genius

Copy link
Copy Markdown

Summary

  • escape user-entered !, %, and _ before substituting text filter values into LIKE expressions
  • add an explicit ESCAPE '!' clause so % and _ are matched literally while the surrounding %...% still performs substring matching
  • add OGR/GeoPackage regression coverage for percent, underscore, the escape character itself, and combined %_ input

Root cause

Text filter values were quoted for SQL string safety, but SQL LIKE metacharacters were left unchanged. As a result, % matched any sequence and _ matched any single character instead of the characters users typed.

Closes #4517.

Validation

  • project astyle check on all changed C++/header files
  • git diff --check
  • SQLite verification of the generated LIKE ... ESCAPE '!' patterns for %, _, !, and %_
  • regression test uses a temporary copy of the project's real roads.gpkg through the OGR provider

The full Mergin Maps native test binary was not built locally because this host does not have the repository's Qt/QGIS/vcpkg toolchain.

AI assistance disclosure

OpenAI Codex assisted with issue triage, implementation, regression-test drafting, and validation. The contribution was reviewed against the repository policies and the generated SQL behavior was independently checked locally.

Escape LIKE metacharacters in user-entered text and cover percent, underscore, escape-character, and combined inputs against an OGR GeoPackage layer.

Assisted-by: OpenAI Codex
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

Successfully merging this pull request may close these issues.

Text filter: % and _ treated as SQL wildcards instead of literal characters

1 participant