File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed 
front/src/components/Dialogs Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,11 @@ export default defineComponent({
7676      this .onDialogCancel (); 
7777    }, 
7878
79-     async  downloadTaskMarkdown(task :  Task ) { 
79+     async  downloadTaskMarkdown(task :  Task ,  visitedUrls :   string []  =  [] ) { 
8080      const =  await  fetch (task .padUrl  +  ' /download/markdown'  
81+       if  (result .status  !=  200 ) { 
82+         return  ` Error fetching markdown for exporting task ${task .title } ` ; 
83+       } 
8184      let  markdown =  await  result .text (); 
8285      if  (markdown .trimStart ().substring (0 , 1 ) !=  ' #'  
8386        // does not start with a title, manually adding... 
@@ -87,22 +90,28 @@ export default defineComponent({
8790        } 
8891        markdown  =  withTitle  +  ' \n ' +  markdown ; 
8992      } 
93+       visitedUrls .push (task .padUrl ); 
9094
9195      //  fetch subtasks recursively 
9296      const =  [ 
9397        ... markdown .matchAll ( 
9498          new  RegExp ( 
95-             ` (https?://${window .location .host }(/pad/[a-zA-Z0-9_-]*)) ` , 
99+             ` (https?://${window .location .host }(/pad/(?!uploads) [a-zA-Z0-9_-]*)) ` , 
96100            ' g'  
97101          ) 
98102        ), 
99103      ]; 
100104
101105      for  (const of  subTasks ) { 
102-         const =  await  this .downloadTaskMarkdown ({ 
103-           ... task , 
104-           padUrl: subTask [1 ], 
105-         }); 
106+         if  (visitedUrls .includes (subTask [1 ])) continue ; 
107+ 
108+         const =  await  this .downloadTaskMarkdown ( 
109+           { 
110+             ... task , 
111+             padUrl: subTask [1 ], 
112+           }, 
113+           visitedUrls .concat ([subTask [1 ]]) 
114+         ); 
106115
107116        markdown  +=  ` \n\n ---\n Content of ${subTask [0 ]}\n\n ${subTaskMarkdown }` ; 
108117      } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments