@@ -17,8 +17,6 @@ export function combineBase64Images(
1717 id : string ;
1818 } > = [ ] ;
1919
20- console . log ( 'Processing images for base64 combining:' , images . length ) ;
21-
2220 for ( let i = 0 ; i < images . length ; i += 2 ) {
2321 const dataPart = images [ i ] ;
2422 const chunkPart = images [ i + 1 ] ;
@@ -31,11 +29,6 @@ export function combineBase64Images(
3129 ) {
3230 // Combine the base64 parts
3331 const combinedSrc = `${ dataPart . src } ,${ chunkPart . src } ` ;
34- console . log ( `Combined base64 image at index ${ i } :` , {
35- original : dataPart . src . substring ( 0 , 50 ) + '...' ,
36- chunk : chunkPart . src . substring ( 0 , 50 ) + '...' ,
37- combined : combinedSrc . substring ( 0 , 50 ) + '...'
38- } ) ;
3932
4033 result . push ( {
4134 ...dataPart ,
@@ -49,20 +42,15 @@ export function combineBase64Images(
4942 } else {
5043 // Handle odd number of images (last item)
5144 if ( dataPart ) {
52- if ( dataPart . src . startsWith ( 'data:' ) ) {
53- console . warn (
54- `Incomplete base64 image at index ${ i } , skipping`
55- ) ;
45+ if ( dataPart . src . startsWith ( 'data:' ) && ! dataPart . src . includes ( ',' ) ) {
46+ // Incomplete base64 image, skip it
5647 } else {
5748 result . push ( dataPart ) ;
5849 }
5950 }
6051 }
6152 }
6253
63- console . log (
64- `Processed ${ images . length } images into ${ result . length } valid images`
65- ) ;
6654 return result ;
6755}
6856
0 commit comments