Summary
q search currently passes user input directly into a LIKE pattern, so % and _ act as wildcards instead of literal characters.
Steps to reproduce
- Create memories with content
foo_bar and fooXbar.
- Query
GET /memories?q=foo_bar.
Expected behavior
Only the literal foo_bar record should match.
Actual behavior
Both records match because _ is treated as a wildcard.
Relevant code
app/storage.py:174-177
README.md:146-148
docs/data_object_schema.md:287-291
Suggested fix
Escape % and _ before building the LIKE pattern, or use an ESCAPE clause.
Tests
Add a regression test covering literal % and _ in q values.
Summary
qsearch currently passes user input directly into aLIKEpattern, so%and_act as wildcards instead of literal characters.Steps to reproduce
foo_barandfooXbar.GET /memories?q=foo_bar.Expected behavior
Only the literal
foo_barrecord should match.Actual behavior
Both records match because
_is treated as a wildcard.Relevant code
app/storage.py:174-177README.md:146-148docs/data_object_schema.md:287-291Suggested fix
Escape
%and_before building theLIKEpattern, or use anESCAPEclause.Tests
Add a regression test covering literal
%and_inqvalues.