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) {