Potential fix for code scanning alert no. 2: Incomplete string escaping or encoding
Merged
BI
5mo ago+1+1+0123456789-1-1-0123456789
Potential fix for https://github.com/BigSimmo/Database/security/code-scanning/2
The fix is to escape backslashes before escaping % and _ in ilikePattern, so user-provided backslashes cannot alter how later escapes are interpreted.
Best fix in this file (without changing behavior otherwise):
- Edit
src/app/api/documents/route.ts - Update
ilikePatternat line 79–81 to:- Replace
\with\\ - Then escape
%and_as currently done - Keep surrounding
%...%wrapping unchanged
- Replace
No new imports or dependencies are needed.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.