ui: storage: handle empty response in case of file upload error

Signed-off-by: Tim Marx <t.marx@proxmox.com>
This commit is contained in:
Tim Marx 2019-05-07 13:46:03 +02:00 committed by Thomas Lamprecht
parent 792fdf4929
commit abffa1a6dc

View File

@ -290,13 +290,18 @@ Ext.define('PVE.storage.Upload', {
me.close();
} else {
var msg = gettext('Error') + " " + xhr.status.toString() + ": " + Ext.htmlEncode(xhr.statusText);
if (xhr.responseText !== "") {
var result = Ext.decode(xhr.responseText);
result.message = msg;
var htmlStatus = Proxmox.Utils.extractRequestError(result, true);
Ext.Msg.alert(gettext('Error'), htmlStatus, function(btn) {
me.close();
});
} else {
Ext.Msg.alert(gettext('Error'), msg, function(btn) {
me.close();
});
}
}
}, false);