[pve-devel] [PATCH manager] ui: storage: handle empty response in case of file upload error
Tim Marx
t.marx at proxmox.com
Tue May 7 13:46:03 CEST 2019
Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
www/manager6/storage/ContentView.js | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/www/manager6/storage/ContentView.js b/www/manager6/storage/ContentView.js
index b7615b22..907521cb 100644
--- a/www/manager6/storage/ContentView.js
+++ b/www/manager6/storage/ContentView.js
@@ -290,13 +290,18 @@ Ext.define('PVE.storage.Upload', {
me.close();
} else {
var msg = gettext('Error') + " " + xhr.status.toString() + ": " + Ext.htmlEncode(xhr.statusText);
- 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();
- });
-
+ 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);
--
2.11.0
More information about the pve-devel
mailing list