for errors during maildir/mbox zip/tgz import in account page, return http 400 for user errors (e.g. bad file format) and show the error message

This commit is contained in:
Mechiel Lukkien
2024-01-05 11:31:05 +01:00
parent 62db2af846
commit ac8256feb6
4 changed files with 20 additions and 16 deletions

View File

@ -973,7 +973,7 @@ const index = async () => {
xhr.addEventListener('load', () => {
console.log('upload done', { xhr: xhr, status: xhr.status });
if (xhr.status !== 200) {
reject({ message: 'status ' + xhr.status });
reject({ message: xhr.status === 400 || xhr.status === 500 ? xhr.responseText : 'status ' + xhr.status });
return;
}
let resp;