3 Commits

Author SHA1 Message Date
c50a584a65 Merge branch 'fix/communicate-file-too-large' into 'marietje-zuid'
Draft: fix(songs): handle HTTP 413 and remove redundant .json() calls

Closes #76 and #84

See merge request technicie/MarietjeDjango!90
2024-03-05 14:54:41 +01:00
77cf681c64 feature(queue): refresh queue after requesting
Closes #84
2024-02-28 00:25:21 +01:00
5c32fcb1d1 fix(songs): handle HTTP 413 and remove redundant .json() calls
Closes #76
2024-02-28 00:20:57 +01:00
2 changed files with 9 additions and 7 deletions

View File

@ -611,6 +611,7 @@
tata.error('', "An unknown exception occurred.")
}
});
queue_vue.refresh();
},
report_song(song_id) {

View File

@ -179,13 +179,14 @@
}).catch(e => {
console.log(e);
if (e instanceof Response) {
try {
e.json().then(data => {
this.fileObjects[i].error_message = data.errorMessage;
this.fileObjects[i].success = false;
});
} catch {
this.fileObjects[i].error_message = "An exception occurred while uploading this file, please try again.";
// Intercept an HTTP 413 error (entity too large), as this might
// be thrown by a (reverse) proxy server and its payload is not
// nicely formatted as the code below expects.
if (e.status === 413) {
this.fileObjects[i].error_message = "The song you tried to upload is too large in size. (HTTP 413 error)";
this.fileObjects[i].success = false;
} else {
this.fileObjects[i].error_message = `${e.statusText} (${e.status})`;
this.fileObjects[i].success = false;
}
} else {