File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed
services/workflows-service/src/document Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -1181,15 +1181,24 @@ export class DocumentService {
11811181 documentSchema ,
11821182 ) ;
11831183 const filesWithBase64 = await Promise . all (
1184- files . map ( async ( { imageUrl, file, ...fileData } ) => ( {
1185- ...fileData ,
1186- imageUrl,
1187- fileName : file . fileName ,
1188- base64 :
1189- this . isCsv ( fileData ) && imageUrl
1190- ? await this . fetchCsvFromUrlAndCovertToBase64 ( imageUrl )
1191- : undefined ,
1192- } ) ) ,
1184+ files . map ( async ( { imageUrl, file, ...fileData } ) => {
1185+ let base64 : string | undefined ;
1186+
1187+ if ( this . isCsv ( fileData ) && imageUrl ) {
1188+ try {
1189+ base64 = await this . fetchCsvFromUrlAndCovertToBase64 ( imageUrl ) ;
1190+ } catch ( error ) {
1191+ console . error ( `Failed to fetch CSV and convert to base64 file ${ file . id } :` , error ) ;
1192+ }
1193+ }
1194+
1195+ return {
1196+ ...fileData ,
1197+ imageUrl,
1198+ fileName : file . fileName ,
1199+ base64,
1200+ } ;
1201+ } ) ,
11931202 ) ;
11941203
11951204 return {
You can’t perform that action at this time.
0 commit comments