@@ -36,9 +36,9 @@ export const convertFiles = async function(fileIds: number[], targetMimeType: st
3636 try {
3737 const results = await Promise . allSettled ( conversions )
3838 const failed = results . filter ( result => result . status === 'rejected' )
39- if ( failed . length ) {
39+ if ( failed . length > 0 ) {
4040 const messages = failed . map ( result => result . reason ?. response ?. data ?. ocs ?. meta ?. message ) as string [ ]
41- logger . error ( 'Failed to convert files' , { fileIds, targetMimeType, error } )
41+ logger . error ( 'Failed to convert files' , { fileIds, targetMimeType, messages } )
4242
4343 // If all failed files have the same error message, show it
4444 if ( new Set ( messages ) . size === 1 ) {
@@ -47,7 +47,7 @@ export const convertFiles = async function(fileIds: number[], targetMimeType: st
4747 }
4848
4949 if ( failed . length === fileIds . length ) {
50- showError ( t ( 'files' , 'Failed to convert files ' ) )
50+ showError ( t ( 'files' , 'All files failed to be converted ' ) )
5151 return
5252 }
5353
@@ -64,7 +64,10 @@ export const convertFiles = async function(fileIds: number[], targetMimeType: st
6464 return
6565 }
6666
67+ // We already check above when all files failed
68+ // if we're here, we have a mix of failed and successful files
6769 showError ( t ( 'files' , '{count} files could not be converted' , { count : failed . length } ) )
70+ showSuccess ( t ( 'files' , '{count} files successfully converted' , { count : fileIds . length - failed . length } ) )
6871 return
6972 }
7073
0 commit comments