Potential fix for code scanning alert no. 2: Incomplete string escaping or encoding

Merged
BI
5mo ago
+1-1

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 ilikePattern at line 79–81 to:
    1. Replace \ with \\
    2. Then escape % and _ as currently done
    3. Keep surrounding %...% wrapping unchanged

No new imports or dependencies are needed.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.