From 473b9d0265568d58326c663e0b006e85e2a35b9d Mon Sep 17 00:00:00 2001 From: si458 Date: Mon, 4 Mar 2024 11:17:43 +0000 Subject: [PATCH] add osx custom filename to zip Signed-off-by: si458 --- webserver.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webserver.js b/webserver.js index c06cdb7b..e05b8d02 100644 --- a/webserver.js +++ b/webserver.js @@ -5843,8 +5843,14 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF var archive = require('archiver')('zip', { level: 5 }); // Sets the compression method. archive.on('error', function (err) { throw err; }); + // Customize the mesh agent file name + var meshfilename = 'MeshAgent-' + mesh.name + '.zip' + if ((domain.agentcustomization != null) && (typeof domain.agentcustomization.filename == 'string')) { + meshfilename = meshfilename.split('meshagent').join(domain.agentcustomization.filename).split('MeshAgent').join(domain.agentcustomization.filename); + } + // Set the agent download including the mesh name. - setContentDispositionHeader(res, 'application/octet-stream', 'MeshAgent-' + mesh.name + '.zip', null, 'MeshAgent.zip'); + setContentDispositionHeader(res, 'application/octet-stream', meshfilename, null, 'MeshAgent.zip'); archive.pipe(res); // Opens the "MeshAgentOSXPackager.zip"