diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2025-01-22 10:47:45 +0100 |
---|---|---|
committer | nextcloud-command <nextcloud-command@users.noreply.github.com> | 2025-01-22 16:29:36 +0000 |
commit | 6673c127ec6d88f5953607b5a47545acd61f8f28 (patch) | |
tree | 7da4e53e26258fd3d5ff744720125cd8292612c1 /apps/files/src | |
parent | 966738b38cf250de2e8d363ad7dd4478142f96b0 (diff) | |
download | nextcloud-server-6673c127ec6d88f5953607b5a47545acd61f8f28.tar.gz nextcloud-server-6673c127ec6d88f5953607b5a47545acd61f8f28.zip |
fix(files): better conversion error messages
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/src')
-rw-r--r-- | apps/files/src/actions/convertUtils.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/files/src/actions/convertUtils.ts b/apps/files/src/actions/convertUtils.ts index 5d72733bc41..f32dbed0cd1 100644 --- a/apps/files/src/actions/convertUtils.ts +++ b/apps/files/src/actions/convertUtils.ts @@ -36,9 +36,9 @@ export const convertFiles = async function(fileIds: number[], targetMimeType: st try { const results = await Promise.allSettled(conversions) const failed = results.filter(result => result.status === 'rejected') - if (failed.length) { + if (failed.length > 0) { const messages = failed.map(result => result.reason?.response?.data?.ocs?.meta?.message) as string[] - logger.error('Failed to convert files', { fileIds, targetMimeType, error }) + logger.error('Failed to convert files', { fileIds, targetMimeType, messages }) // If all failed files have the same error message, show it if (new Set(messages).size === 1) { @@ -47,7 +47,7 @@ export const convertFiles = async function(fileIds: number[], targetMimeType: st } if (failed.length === fileIds.length) { - showError(t('files', 'Failed to convert files')) + showError(t('files', 'All files failed to be converted')) return } @@ -64,7 +64,10 @@ export const convertFiles = async function(fileIds: number[], targetMimeType: st return } + // We already check above when all files failed + // if we're here, we have a mix of failed and successful files showError(t('files', '{count} files could not be converted', { count: failed.length })) + showSuccess(t('files', '{count} files successfully converted', { count: fileIds.length - failed.length })) return } |