mirror of
https://github.com/nextcloud/server.git
synced 2026-06-07 07:43:18 -04:00
fix(files): use backend error message if provided
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
parent
9ff82cd326
commit
f9c770bbc3
3 changed files with 10 additions and 7 deletions
|
|
@ -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
|
||||
|
|
@ -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'))
|
||||
},
|
||||
|
||||
|
|
|
|||
4
dist/files-main.js
vendored
4
dist/files-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-main.js.map
vendored
2
dist/files-main.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue