Fixed improved content-disposition fix.

This commit is contained in:
Ylian Saint-Hilaire 2019-04-30 16:07:14 -07:00
parent 8790e4e284
commit 2041f9bba0
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "meshcentral",
"version": "0.3.3-m",
"version": "0.3.3-n",
"keywords": [
"Remote Management",
"Intel AMT",

View File

@ -2420,7 +2420,13 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
// Setup the response output
var archive = require('archiver')('zip', { level: 5 }); // Sets the compression method.
archive.on('error', function (err) { throw err; });
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/zip', 'Content-Disposition': 'attachment; filename="MeshAgent-' + mesh.name + '.zip"' });
try {
// Set the agent download including the mesh name.
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/zip', 'Content-Disposition': 'attachment; filename="MeshAgent-' + mesh.name + '.zip"' });
} catch (ex) {
// If the mesh name contains invalid characters, just use a generic name.
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/zip', 'Content-Disposition': 'attachment; filename="MeshAgent.zip"' });
}
archive.pipe(res);
// Opens the "MeshAgentOSXPackager.zip"