From cf953c393723f282c7f9b8f7c115bf6572f3b2e4 Mon Sep 17 00:00:00 2001 From: BigSimmo <87357024+BigSimmo@users.noreply.github.com> Date: Sun, 14 Jun 2026 17:05:08 +0800 Subject: [PATCH] Potential fix for code scanning alert no. 2: Incomplete string escaping or encoding Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/app/api/documents/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/documents/route.ts b/src/app/api/documents/route.ts index 95ce5eb21..1ee0b56d5 100644 --- a/src/app/api/documents/route.ts +++ b/src/app/api/documents/route.ts @@ -77,7 +77,7 @@ function parseOffset(value: string | null) { } function ilikePattern(value: string) { - return `%${value.replace(/[%_]/g, "\\$&")}%`; + return `%${value.replace(/\\/g, "\\\\").replace(/[%_]/g, "\\$&")}%`; } function safeSearchTerm(value: string) {