IGNITE-3319 Upgraded to latest jszip.

Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/daac3a9e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/daac3a9e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/daac3a9e

Branch: refs/heads/ignite-3262
Commit: daac3a9ed8495a4e93d094ebb43bdb2daeeb8012
Parents: ab9f2da
Author: Andrey Novikov <[email protected]>
Authored: Wed Jun 29 09:04:19 2016 +0700
Committer: Andrey Novikov <[email protected]>
Committed: Wed Jun 29 09:04:19 2016 +0700

----------------------------------------------------------------------
 .../src/main/js/serve/routes/agent.js           | 30 ++++++++++----------
 1 file changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/daac3a9e/modules/web-console/src/main/js/serve/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/web-console/src/main/js/serve/routes/agent.js 
b/modules/web-console/src/main/js/serve/routes/agent.js
index 020b692..48ec131 100644
--- a/modules/web-console/src/main/js/serve/routes/agent.js
+++ b/modules/web-console/src/main/js/serve/routes/agent.js
@@ -53,26 +53,26 @@ module.exports.factory = function(_, express, fs, JSZip, 
settings, agentMgr) {
                 if (errFs)
                     return res.download(agentPathZip, agentZip);
 
-                const zip = new JSZip(data);
-
-                const prop = [];
-
-                const host = req.hostname.match(/:/g) ? req.hostname.slice(0, 
req.hostname.indexOf(':')) : req.hostname;
+                // Set the archive name.
+                res.attachment(agentZip);
 
-                prop.push('tokens=' + req.user.token);
-                prop.push('server-uri=' + (settings.agent.SSLOptions ? 'https' 
: 'http') + '://' + host + ':' + settings.agent.port);
-                prop.push('#Uncomment following options if needed:');
-                prop.push('#node-uri=http://localhost:8080');
-                prop.push('#driver-folder=./jdbc-drivers');
+                JSZip.loadAsync(data)
+                    .then((zip) => {
+                        const prop = [];
 
-                zip.file(agentFld + '/default.properties', prop.join('\n'));
+                        const host = req.hostname.match(/:/g) ? 
req.hostname.slice(0, req.hostname.indexOf(':')) : req.hostname;
 
-                const buffer = zip.generate({type: 'nodebuffer', platform: 
'UNIX'});
+                        prop.push('tokens=' + req.user.token);
+                        prop.push('server-uri=' + (settings.agent.SSLOptions ? 
'https' : 'http') + '://' + host + ':' + settings.agent.port);
+                        prop.push('#Uncomment following options if needed:');
+                        prop.push('#node-uri=http://localhost:8080');
+                        prop.push('#driver-folder=./jdbc-drivers');
 
-                // Set the archive name.
-                res.attachment(agentZip);
+                        zip.file(agentFld + '/default.properties', 
prop.join('\n'));
 
-                res.send(buffer);
+                        zip.generateAsync({type: 'nodebuffer', platform: 
'UNIX'})
+                            .then((buffer) => res.send(buffer));
+                    });
             });
         });
 

Reply via email to