File tree Expand file tree Collapse file tree 2 files changed +24
-19
lines changed Expand file tree Collapse file tree 2 files changed +24
-19
lines changed Original file line number Diff line number Diff line change @@ -68,25 +68,28 @@ describe("GithubRepoLoader URL encoding", () => {
6868 const mockFetch = jest . fn ( ) . mockImplementation ( ( url ) => {
6969 // Check that special characters are properly encoded in the URL
7070 expect ( url ) . toContain ( "src%2Fapp%2F%255Fmeta" ) ; // The full encoded path
71-
71+
7272 return Promise . resolve ( {
7373 ok : true ,
74- json : ( ) => Promise . resolve ( [ {
75- name : "%5Fmeta" ,
76- path : "src/app/%5Fmeta" ,
77- type : "dir" ,
78- size : 0 ,
79- url : "https://api.github.com/repos/test/test/contents/src/app/%5Fmeta" ,
80- html_url : "" ,
81- sha : "abc123" ,
82- git_url : "" ,
83- download_url : "" ,
84- _links : {
85- self : "" ,
86- git : "" ,
87- html : "" ,
88- } ,
89- } ] ) ,
74+ json : ( ) =>
75+ Promise . resolve ( [
76+ {
77+ name : "%5Fmeta" ,
78+ path : "src/app/%5Fmeta" ,
79+ type : "dir" ,
80+ size : 0 ,
81+ url : "https://api.github.com/repos/test/test/contents/src/app/%5Fmeta" ,
82+ html_url : "" ,
83+ sha : "abc123" ,
84+ git_url : "" ,
85+ download_url : "" ,
86+ _links : {
87+ self : "" ,
88+ git : "" ,
89+ html : "" ,
90+ } ,
91+ } ,
92+ ] ) ,
9093 } ) ;
9194 } ) ;
9295
@@ -103,7 +106,7 @@ describe("GithubRepoLoader URL encoding", () => {
103106
104107 // This should call fetchRepoFiles with "src/app/%5Fmeta" path
105108 await loader . load ( ) ;
106-
109+
107110 // Verify that fetch was called with properly encoded URL
108111 expect ( mockFetch ) . toHaveBeenCalledWith (
109112 expect . stringContaining ( "contents/src%2Fapp%2F%255Fmeta" ) ,
Original file line number Diff line number Diff line change @@ -647,7 +647,9 @@ export class GithubRepoLoader
647647 * @returns A promise that resolves to an array of GithubFile instances.
648648 */
649649 private async fetchRepoFiles ( path : string ) : Promise < GithubFile [ ] > {
650- const url = `${ this . apiUrl } /repos/${ this . owner } /${ this . repo } /contents/${ encodeURIComponent ( path ) } ?ref=${ this . branch } ` ;
650+ const url = `${ this . apiUrl } /repos/${ this . owner } /${
651+ this . repo
652+ } /contents/${ encodeURIComponent ( path ) } ?ref=${ this . branch } `;
651653 return this . caller . call ( async ( ) => {
652654 this . log ( `Fetching ${ url } ` ) ;
653655 const response = await fetch ( url , { headers : this . headers } ) ;
You can’t perform that action at this time.
0 commit comments