Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable28] fix(files): use backend error message if provided #42767

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions apps/files/src/views/FilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,6 @@ export default defineComponent({
} else if (status === 403) {
showError(this.t('files', 'Operation is blocked by access control'))
return
} else if (status !== 0) {
showError(this.t('files', 'Error when assembling chunks, status code {status}', { status }))
return
}

// Else we try to parse the response error message
Expand All @@ -552,12 +549,18 @@ export default defineComponent({
const response = await parser.parseStringPromise(upload.response?.data)
const message = response['s:message'][0] as string
if (typeof message === 'string' && message.trim() !== '') {
// Unfortunatly, the server message is not translated
// The server message is also translated
showError(this.t('files', 'Error during upload: {message}', { message }))
return
}
} catch (error) {}

// Finally, check the status code if we have one
if (status !== 0) {
showError(this.t('files', 'Error during upload, status code {status}', { status }))
return
}

showError(this.t('files', 'Unknown error during upload'))
},

Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.