@@ -224,9 +224,7 @@ function createGitLabProvider(options: GitOptions): GitProvider {
224224
225225 try {
226226 const encodedPath = encodeURIComponent ( path )
227- const glFile = await $api ( `/repository/files/${ encodedPath } /raw?ref=${ branch } ` )
228-
229- // Get file metadata
227+ // GitLab API returns base64-encoded content when using /repository/files endpoint (without /raw)
230228 const fileMetadata = await $api ( `/repository/files/${ encodedPath } ?ref=${ branch } ` )
231229
232230 const gitFile : GitFile = {
@@ -235,8 +233,9 @@ function createGitLabProvider(options: GitOptions): GitProvider {
235233 sha : fileMetadata . blob_id ,
236234 size : fileMetadata . size ,
237235 url : fileMetadata . file_path ,
238- content : typeof glFile === 'string' ? glFile : undefined ,
239- encoding : fileMetadata . encoding ,
236+ content : fileMetadata . content ,
237+ encoding : 'base64' as const ,
238+ provider : 'gitlab' as const ,
240239 }
241240
242241 if ( cached ) {
@@ -251,13 +250,13 @@ function createGitLabProvider(options: GitOptions): GitProvider {
251250 return null
252251 }
253252
253+ console . error ( `Failed to fetch file from GitLab: ${ path } ` , error )
254+
254255 // For development, show alert. In production, you might want to use a toast notification
255256 if ( process . env . NODE_ENV === 'development' ) {
256257 alert ( `Failed to fetch file: ${ path } \n${ ( error as { message ?: string } ) . message || error } ` )
257258 }
258259
259- console . error ( `Failed to fetch file from GitLab: ${ path } ` , error )
260-
261260 return null
262261 }
263262 }
0 commit comments