File tree Expand file tree Collapse file tree 2 files changed +10
-18
lines changed
src/services/code-index/vector-store Expand file tree Collapse file tree 2 files changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -21,22 +21,14 @@ vitest.mock("../../../../i18n", () => ({
2121 return key // Just return the key for other cases
2222 } ,
2323} ) )
24- vitest . mock ( "path" , ( ) => ( {
25- ...vitest . importActual ( "path" ) ,
26- sep : "/" ,
27- posix : {
28- normalize : ( p : string ) => {
29- // Simple implementation of posix.normalize for testing
30- // Remove redundant slashes and handle . and .. segments
31- return (
32- p
33- . split ( "/" )
34- . filter ( ( segment ) => segment !== "" && segment !== "." )
35- . join ( "/" ) || "."
36- )
37- } ,
38- } ,
39- } ) )
24+ vitest . mock ( "path" , async ( ) => {
25+ const actual = await vitest . importActual ( "path" )
26+ return {
27+ ...actual ,
28+ sep : "/" ,
29+ posix : actual . posix ,
30+ }
31+ } )
4032
4133const mockQdrantClientInstance = {
4234 getCollection : vitest . fn ( ) ,
Original file line number Diff line number Diff line change @@ -377,15 +377,15 @@ export class QdrantVectorStore implements IVectorStore {
377377 if ( directoryPrefix ) {
378378 // Check if the path represents current directory
379379 const normalizedPrefix = path . posix . normalize ( directoryPrefix . replace ( / \\ / g, "/" ) )
380- if ( normalizedPrefix === "." || normalizedPrefix === "" || normalizedPrefix === "./ " ) {
380+ if ( normalizedPrefix === "." || normalizedPrefix === "./ " || normalizedPrefix === "" ) {
381381 // Don't create a filter - search entire workspace
382382 filter = undefined
383383 } else {
384384 // Remove leading "./" from paths like "./src" to normalize them
385385 const cleanedPrefix = normalizedPrefix . startsWith ( "./" )
386386 ? normalizedPrefix . slice ( 2 )
387387 : normalizedPrefix
388- const segments = cleanedPrefix . split ( "/" ) . filter ( Boolean )
388+ const segments = path . posix . normalize ( cleanedPrefix ) . split ( "/" ) . filter ( Boolean )
389389 if ( segments . length > 0 ) {
390390 filter = {
391391 must : segments . map ( ( segment , index ) => ( {
You can’t perform that action at this time.
0 commit comments