@@ -12,27 +12,27 @@ import escapeStringRegexp from "escape-string-regexp";
1212// This will allow us to support permalinks to files at a specific revision that may not be indexed
1313// by zoekt. We should also refactor this out of the /search folder.
1414
15- export const getFileSource = async ( { fileName , repository , branch } : FileSourceRequest ) : Promise < FileSourceResponse | ServiceError > => sew ( ( ) =>
15+ export const getFileSource = async ( { path , repo , ref } : FileSourceRequest ) : Promise < FileSourceResponse | ServiceError > => sew ( ( ) =>
1616 withOptionalAuthV2 ( async ( ) => {
1717 const query : QueryIR = {
1818 and : {
1919 children : [
2020 {
2121 repo : {
22- regexp : `^${ escapeStringRegexp ( repository ) } $` ,
22+ regexp : `^${ escapeStringRegexp ( repo ) } $` ,
2323 } ,
2424 } ,
2525 {
2626 substring : {
27- pattern : fileName ,
27+ pattern : path ,
2828 case_sensitive : true ,
2929 file_name : true ,
3030 content : false ,
3131 }
3232 } ,
33- ...( branch ? [ {
33+ ...( ref ? [ {
3434 branch : {
35- pattern : branch ,
35+ pattern : ref ,
3636 exact : true ,
3737 } ,
3838 } ] : [ ] )
@@ -56,7 +56,7 @@ export const getFileSource = async ({ fileName, repository, branch }: FileSource
5656 const files = searchResponse . files ;
5757
5858 if ( ! files || files . length === 0 ) {
59- return fileNotFound ( fileName , repository ) ;
59+ return fileNotFound ( path , repo ) ;
6060 }
6161
6262 const file = files [ 0 ] ;
@@ -72,12 +72,12 @@ export const getFileSource = async ({ fileName, repository, branch }: FileSource
7272 return {
7373 source,
7474 language,
75- path : fileName ,
76- repo : repository ,
75+ path,
76+ repo,
7777 repoCodeHostType : repoInfo . codeHostType ,
7878 repoDisplayName : repoInfo . displayName ,
7979 repoExternalWebUrl : repoInfo . webUrl ,
80- branch,
80+ branch : ref ,
8181 webUrl : file . webUrl ,
8282 externalWebUrl : file . externalWebUrl ,
8383 } satisfies FileSourceResponse ;
0 commit comments