File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,14 @@ export const fetchGoogleDocsFiles = async (files: string[]) => {
2020 console . log ( "\nDownloading document" , documentId ) ;
2121 try {
2222 const result = await docs . documents . get ( {
23- documentId,
23+ documentId : documentId . split ( ":" ) [ 0 ] ,
2424 auth : oauth2Client ,
2525 } ) ;
2626 if ( ! result . data . title ) throw new Error ( "Title not found" ) ;
27- await fs . writeFile (
28- join ( "." , ` ${ result . data . title } .md` ) ,
29- googleDocsToMarkdown ( result . data )
30- ) ;
27+ const title = documentId . includes ( ":" )
28+ ? documentId . split ( ":" ) [ 1 ]
29+ : ` ${ result . data . title } .md` ;
30+ await fs . writeFile ( join ( "." , title ) , googleDocsToMarkdown ( result . data ) ) ;
3131 console . log ( "Downloaded document" , result . data . title ) ;
3232 } catch ( error ) {
3333 console . log ( "Got an error" , error ) ;
You can’t perform that action at this time.
0 commit comments