mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-10 13:43:38 +08:00
File Uploads: Added basic validation response formatting
Tested via app-level validation file limit, and then also with nginx file post limit. For #4996
This commit is contained in:
@ -181,10 +181,7 @@ export class Dropzone extends Component {
|
||||
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
|
||||
upload.markSuccess(component.successMessage);
|
||||
} else if (this.readyState === XMLHttpRequest.DONE && this.status >= 400) {
|
||||
const content = this.responseText;
|
||||
const data = content.startsWith('{') ? JSON.parse(content) : {message: content};
|
||||
const message = data?.message || data?.error || content;
|
||||
upload.markError(message);
|
||||
upload.markError(window.$http.formatErrorResponseText(this.responseText));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user