v0.5.10: /export — attachment default, ?view=1 inline, ?filename=custom
This commit is contained in:
@@ -95,7 +95,9 @@ function createEntriesRouter({ q }) {
|
||||
const cidrs = await q.getExportCIDRs(companyId);
|
||||
const aggregated = aggregateCIDRs(cidrs);
|
||||
res.setHeader('Content-Type', 'text/plain; charset=utf-8');
|
||||
res.setHeader('Content-Disposition', 'inline; filename="whitelist.txt"');
|
||||
const fname = req.query.filename || 'white-list.txt';
|
||||
const disp = req.query.view === '1' ? 'inline' : 'attachment';
|
||||
res.setHeader('Content-Disposition', `${disp}; filename="${fname}"`);
|
||||
res.send(aggregated.join('\n') + (aggregated.length ? '\n' : ''));
|
||||
} catch (e) {
|
||||
res.status(500).json({ error: e.message });
|
||||
|
||||
Reference in New Issue
Block a user