@@ -103,33 +103,11 @@ export class RepoStorageBackend implements StorageBackend {
103103
104104 public async getFile ( path : string ) : Promise < string | null > {
105105 const fullPath = `${ SYNC_DIR } /${ path } ` ;
106- // Add cache-bust to avoid stale GitHub API responses
106+ const branch = await this . getBranch ( ) ;
107+ // Use raw.githubusercontent.com with cache-bust to avoid stale CDN responses
107108 const cacheBust = Date . now ( ) ;
108- const res = await this . fetchAllowNotFound ( `/contents/${ fullPath } ?cb=${ String ( cacheBust ) } ` ) ;
109- if ( ! res ?. ok ) return null ;
110-
111- const data = ( await res . json ( ) ) as ContentFile ;
112-
113- // For files >1MB, GitHub returns empty content and provides download_url
114- if ( ! data . content && data . size > 1000000 ) {
115- const branch = await this . getBranch ( ) ;
116- // Add cache-bust to avoid stale CDN responses
117- const downloadUrl = `https://raw.githubusercontent.com/${ this . owner } /${ this . repo } /${ branch } /${ fullPath } ?cb=${ String ( cacheBust ) } ` ;
118- const downloadRes = await fetchWithRetry (
119- downloadUrl ,
120- {
121- headers : { Authorization : `Bearer ${ this . token } ` } ,
122- } ,
123- this . maxRetries ,
124- this . retryDelayMs
125- ) ;
126-
127- if ( ! downloadRes . ok ) return null ;
128- return await downloadRes . text ( ) ;
129- }
130-
131- if ( ! data . content ) return null ;
132- return Buffer . from ( data . content , 'base64' ) . toString ( 'utf-8' ) ;
109+ const url = `https://raw.githubusercontent.com/${ this . owner } /${ this . repo } /${ branch } /${ fullPath } ?cb=${ String ( cacheBust ) } ` ;
110+ return await this . fetchRawFile ( url ) ;
133111 }
134112
135113 public async updateFiles ( files : Record < string , string | null > ) : Promise < void > {
0 commit comments