Skip to content

Commit a70abc3

Browse files
committed
fix(files): use backend error message if provided
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent fdb4e77 commit a70abc3

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

apps/files/src/views/FilesList.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,6 @@ export default defineComponent({
536536
} else if (status === 403) {
537537
showError(this.t('files', 'Operation is blocked by access control'))
538538
return
539-
} else if (status !== 0) {
540-
showError(this.t('files', 'Error when assembling chunks, status code {status}', { status }))
541-
return
542539
}
543540
544541
// Else we try to parse the response error message
@@ -547,12 +544,18 @@ export default defineComponent({
547544
const response = await parser.parseStringPromise(upload.response?.data)
548545
const message = response['s:message'][0] as string
549546
if (typeof message === 'string' && message.trim() !== '') {
550-
// Unfortunatly, the server message is not translated
547+
// The server message is also translated
551548
showError(this.t('files', 'Error during upload: {message}', { message }))
552549
return
553550
}
554551
} catch (error) {}
555552
553+
// Finally, check the status code if we have one
554+
if (status !== 0) {
555+
showError(this.t('files', 'Error during upload, status code {status}', { status }))
556+
return
557+
}
558+
556559
showError(this.t('files', 'Unknown error during upload'))
557560
},
558561

0 commit comments

Comments
 (0)