@@ -340,7 +340,6 @@ async function parseWithFileParser(
340340 let content : string
341341
342342 if ( fileUrl . startsWith ( 'data:' ) ) {
343- // Handle data URI (e.g., data:text/plain;base64,SGVsbG8gV29ybGQ=)
344343 logger . info ( `Processing data URI for: ${ filename } ` )
345344
346345 try {
@@ -349,21 +348,16 @@ async function parseWithFileParser(
349348 throw new Error ( 'Invalid data URI format' )
350349 }
351350
352- // Check if it's base64 encoded
353351 if ( header . includes ( 'base64' ) ) {
354- // Decode base64 content
355352 const buffer = Buffer . from ( base64Data , 'base64' )
356353 content = buffer . toString ( 'utf8' )
357354 } else {
358- // Handle URL-encoded data URIs (though we primarily use base64)
359355 content = decodeURIComponent ( base64Data )
360356 }
361357
362- // For text content, return it directly
363358 if ( mimeType === 'text/plain' ) {
364359 logger . info ( `Data URI processed successfully for text content: ${ filename } ` )
365360 } else {
366- // For other file types, try to parse the buffer
367361 const extension = filename . split ( '.' ) . pop ( ) ?. toLowerCase ( ) || 'txt'
368362 const buffer = Buffer . from ( base64Data , 'base64' )
369363 const result = await parseBuffer ( buffer , extension )
@@ -375,7 +369,6 @@ async function parseWithFileParser(
375369 )
376370 }
377371 } else if ( fileUrl . startsWith ( 'http://' ) || fileUrl . startsWith ( 'https://' ) ) {
378- // Download and parse remote file with timeout
379372 const controller = new AbortController ( )
380373 const timeoutId = setTimeout ( ( ) => controller . abort ( ) , TIMEOUTS . FILE_DOWNLOAD )
381374
@@ -389,7 +382,6 @@ async function parseWithFileParser(
389382
390383 const buffer = Buffer . from ( await response . arrayBuffer ( ) )
391384
392- // Extract file extension from filename
393385 const extension = filename . split ( '.' ) . pop ( ) ?. toLowerCase ( ) || ''
394386 if ( ! extension ) {
395387 throw new Error ( `Could not determine file extension from filename: ${ filename } ` )
0 commit comments