mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 21:51:23 +00:00
Fix file upload.
This commit is contained in:
@@ -1115,13 +1115,14 @@ GuacUI.Client.attach = function(guac) {
|
|||||||
var offset = 0;
|
var offset = 0;
|
||||||
|
|
||||||
// Invalidate stream on all errors
|
// Invalidate stream on all errors
|
||||||
stream.onerror = function(text, code) {
|
|
||||||
valid = false;
|
|
||||||
upload.showError(text);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Continue upload when acknowledged
|
// 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
|
// Abort upload if stream is invalid
|
||||||
if (!valid) return false;
|
if (!valid) return false;
|
||||||
@@ -1131,14 +1132,14 @@ GuacUI.Client.attach = function(guac) {
|
|||||||
var base64 = _get_base64(slice);
|
var base64 = _get_base64(slice);
|
||||||
|
|
||||||
// Write packet
|
// Write packet
|
||||||
stream.write(base64);
|
stream.sendBlob(base64);
|
||||||
|
|
||||||
// Advance to next packet
|
// Advance to next packet
|
||||||
offset += 4096;
|
offset += 4096;
|
||||||
|
|
||||||
// If at end, stop upload
|
// If at end, stop upload
|
||||||
if (offset >= bytes.length) {
|
if (offset >= bytes.length) {
|
||||||
stream.close();
|
stream.sendEnd();
|
||||||
GuacUI.Client.notification_area.removeChild(upload.getElement());
|
GuacUI.Client.notification_area.removeChild(upload.getElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user