Skip to content

Commit 8c3f8fe

Browse files
skjnldsvnextcloud-command
authored andcommitted
fix(files): use backend error message if provided
Signed-off-by: John Molakvoæ <[email protected]> Signed-off-by: nextcloud-command <[email protected]>
1 parent 56ac01d commit 8c3f8fe

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

apps/files/src/views/FilesList.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,6 @@ export default defineComponent({
541541
} else if (status === 403) {
542542
showError(this.t('files', 'Operation is blocked by access control'))
543543
return
544-
} else if (status !== 0) {
545-
showError(this.t('files', 'Error when assembling chunks, status code {status}', { status }))
546-
return
547544
}
548545
549546
// Else we try to parse the response error message
@@ -552,12 +549,18 @@ export default defineComponent({
552549
const response = await parser.parseStringPromise(upload.response?.data)
553550
const message = response['s:message'][0] as string
554551
if (typeof message === 'string' && message.trim() !== '') {
555-
// Unfortunatly, the server message is not translated
552+
// The server message is also translated
556553
showError(this.t('files', 'Error during upload: {message}', { message }))
557554
return
558555
}
559556
} catch (error) {}
560557
558+
// Finally, check the status code if we have one
559+
if (status !== 0) {
560+
showError(this.t('files', 'Error during upload, status code {status}', { status }))
561+
return
562+
}
563+
561564
showError(this.t('files', 'Unknown error during upload'))
562565
},
563566

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)