mirror of
https://github.com/WeeJeWel/wg-easy.git
synced 2024-11-17 16:09:23 +08:00
Merge pull request #83 from vojtad/fix-configs-for-windows
Normalize config file name for download to make it work on Windows
This commit is contained in:
commit
a8990b2f48
@ -99,7 +99,8 @@ module.exports = class Server {
|
||||
const { clientId } = req.params;
|
||||
const client = await WireGuard.getClient({ clientId });
|
||||
const config = await WireGuard.getClientConfiguration({ clientId });
|
||||
res.header('Content-Disposition', `attachment; filename="${client.name}.conf"`);
|
||||
const configName = client.name.replace(/[^a-zA-Z0-9_=+.-]/g, '-').replace(/(-{2,}|-$)/g, '-').replace(/-$/, '').substring(0, 32);
|
||||
res.header('Content-Disposition', `attachment; filename="${configName}.conf"`);
|
||||
res.header('Content-Type', 'text/plain');
|
||||
res.send(config);
|
||||
}))
|
||||
|
Loading…
Reference in New Issue
Block a user