@@ -420,6 +420,25 @@ describe("QdrantVectorStore", () => {
420420 expect ( ( vectorStoreWithTrailingSlash as any ) . qdrantUrl ) . toBe ( "http://localhost:6333/api/" )
421421 } )
422422
423+ it ( "should normalize URL pathname by removing multiple trailing slashes for prefix" , ( ) => {
424+ const vectorStoreWithMultipleTrailingSlashes = new QdrantVectorStore (
425+ mockWorkspacePath ,
426+ "http://localhost:6333/api///" ,
427+ mockVectorSize ,
428+ )
429+ expect ( QdrantClient ) . toHaveBeenLastCalledWith ( {
430+ host : "localhost" ,
431+ https : false ,
432+ port : 6333 ,
433+ prefix : "/api" , // All trailing slashes should be removed
434+ apiKey : undefined ,
435+ headers : {
436+ "User-Agent" : "Roo-Code" ,
437+ } ,
438+ } )
439+ expect ( ( vectorStoreWithMultipleTrailingSlashes as any ) . qdrantUrl ) . toBe ( "http://localhost:6333/api///" )
440+ } )
441+
423442 it ( "should handle multiple path segments correctly for prefix" , ( ) => {
424443 const vectorStoreWithMultiSegment = new QdrantVectorStore (
425444 mockWorkspacePath ,
@@ -438,14 +457,10 @@ describe("QdrantVectorStore", () => {
438457 } )
439458 expect ( ( vectorStoreWithMultiSegment as any ) . qdrantUrl ) . toBe ( "http://localhost:6333/api/v1/qdrant" )
440459 } )
441-
442- it ( "should handle complex URL with multiple segments, trailing slash, query params, and fragment" , ( ) => {
443- const complexUrl = "https://example.com/ollama/api/v1/?key=value#pos"
444- const vectorStoreComplex = new QdrantVectorStore (
445- mockWorkspacePath ,
446- complexUrl ,
447- mockVectorSize ,
448- )
460+
461+ it ( "should handle complex URL with multiple segments, multiple trailing slashes, query params, and fragment" , ( ) => {
462+ const complexUrl = "https://example.com/ollama/api/v1///?key=value#pos"
463+ const vectorStoreComplex = new QdrantVectorStore ( mockWorkspacePath , complexUrl , mockVectorSize )
449464 expect ( QdrantClient ) . toHaveBeenLastCalledWith ( {
450465 host : "example.com" ,
451466 https : true ,
0 commit comments