From 853d5d5cc4b15f1633adf441910a058c2f3288b9 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 28 Feb 2014 15:51:10 -0800 Subject: [PATCH] Fix file upload. --- guacamole/src/main/webapp/scripts/client-ui.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/guacamole/src/main/webapp/scripts/client-ui.js b/guacamole/src/main/webapp/scripts/client-ui.js index 6640b95e4..ffe17ec5e 100644 --- a/guacamole/src/main/webapp/scripts/client-ui.js +++ b/guacamole/src/main/webapp/scripts/client-ui.js @@ -1115,13 +1115,14 @@ GuacUI.Client.attach = function(guac) { var offset = 0; // Invalidate stream on all errors - stream.onerror = function(text, code) { - valid = false; - upload.showError(text); - }; - // Continue upload when acknowledged - stream.onack = function() { + stream.onack = function(text, code) { + + // Handle codes + if (code >= 0x0100) { + valid = false; + upload.showError(text); + } // Abort upload if stream is invalid if (!valid) return false; @@ -1131,14 +1132,14 @@ GuacUI.Client.attach = function(guac) { var base64 = _get_base64(slice); // Write packet - stream.write(base64); + stream.sendBlob(base64); // Advance to next packet offset += 4096; // If at end, stop upload if (offset >= bytes.length) { - stream.close(); + stream.sendEnd(); GuacUI.Client.notification_area.removeChild(upload.getElement()); }