Skip to content

Commit

Permalink
Update uploadForm.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kongtiaowang authored Apr 9, 2024
1 parent 5c1f852 commit b9569dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/media/jsx/uploadForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class MediaUploadForm extends Component {
let msg = 'Upload error!';
if (xhr.response) {
if (xhr.statusText) {
msg = JSON.stringify(xhr.statusText);
msg = JSON.parse(xhr.response).message;
}
}
if (xhr.status === 413) {
Expand All @@ -369,8 +369,8 @@ class MediaUploadForm extends Component {

xhr.addEventListener('error', () => {
console.error(xhr.status + ': ' + xhr.statusText);
let msg = xhr.response && xhr.response.message
? xhr.response.message
let msg = xhr.response && JSON.parse(xhr.response).message
? JSON.parse(xhr.response).message
: 'Upload error!';
this.setState({
errorMessage: msg,
Expand Down

0 comments on commit b9569dd

Please # to comment.