Skip to content

Commit a1940da

Browse files
committed
fix: Escape backslashes in directoryPrefix for file path filtering in search
1 parent 4b97e12 commit a1940da

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/services/code-index/vector-store/local-vector-store.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ export class LocalVectorStore implements IVectorStore {
283283
let filter = ""
284284
if (directoryPrefix) {
285285
// Use backticks for column name and escape single quotes in directoryPrefix
286-
filter = `\`filePath\` LIKE '${directoryPrefix}%'`
286+
const filterDirectoryPrefix = directoryPrefix.replace(/\\/g, "\\\\")
287+
filter = `\`filePath\` LIKE '${filterDirectoryPrefix}%'`
287288
}
288289
// Perform vector search
289290
let searchQuery = table.vectorSearch(queryVector)

0 commit comments

Comments
 (0)