mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 21:51:23 +00:00
Fix file download.
This commit is contained in:
@@ -820,18 +820,21 @@ GuacUI.Client.attach = function(guac) {
|
|||||||
var download = new GuacUI.Download(filename);
|
var download = new GuacUI.Download(filename);
|
||||||
download.updateProgress(getSizeString(0));
|
download.updateProgress(getSizeString(0));
|
||||||
|
|
||||||
|
var blob_reader = new Guacamole.BlobReader(stream, mimetype);
|
||||||
|
|
||||||
GuacUI.Client.notification_area.appendChild(download.getElement());
|
GuacUI.Client.notification_area.appendChild(download.getElement());
|
||||||
|
|
||||||
// Update progress as data is received
|
// Update progress as data is received
|
||||||
stream.onreceive = function() {
|
blob_reader.onprogress = function() {
|
||||||
download.updateProgress(getSizeString(stream.getLength()));
|
download.updateProgress(getSizeString(blob_reader.getLength()));
|
||||||
|
stream.sendAck("Received", 0x0000);
|
||||||
};
|
};
|
||||||
|
|
||||||
// When complete, prompt for download
|
// When complete, prompt for download
|
||||||
stream.onclose = function() {
|
blob_reader.onend = function() {
|
||||||
|
|
||||||
download.ondownload = function() {
|
download.ondownload = function() {
|
||||||
saveAs(stream.getBlob(), filename);
|
saveAs(blob_reader.getBlob(), filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
download.complete();
|
download.complete();
|
||||||
@@ -843,6 +846,8 @@ GuacUI.Client.attach = function(guac) {
|
|||||||
GuacUI.Client.notification_area.removeChild(download.getElement());
|
GuacUI.Client.notification_area.removeChild(download.getElement());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
stream.sendAck("Ready", 0x0000);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user