File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -62,16 +62,17 @@ function findEntry(
6262 return bestEntry ?. entry ?? null ;
6363}
6464
65- async function parseContent ( content : Content & { _file ?: string } , dirName : string = "." ) {
65+ async function parseContent (
66+ content : Omit < Content & { _file ?: string } , "text" > & { text : Buffer | string } ,
67+ dirName : string = "." ,
68+ ) {
6669 if ( ! content ) return undefined ;
6770 if ( content . _file && ! content . text ) {
6871 const contentFilePath = path . join ( dirName , content . _file ) ;
69- content . text = await promises . readFile ( contentFilePath , {
70- encoding : "utf8" ,
71- } ) ;
72+ content . text = await promises . readFile ( contentFilePath ) ;
7273 }
7374 if ( ! content . text ) return undefined ;
74- if ( content . encoding === "base64" ) {
75+ if ( content . encoding === "base64" && typeof content . text === "string" ) {
7576 return Buffer . from ( content . text , "base64" ) ;
7677 } else {
7778 return content . text ;
You can’t perform that action at this time.
0 commit comments