We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ca97a7 commit 4df51b0Copy full SHA for 4df51b0
1 file changed
src/controllers/GameController.ts
@@ -417,7 +417,9 @@ export class Games {
417
return res.status(fileRes.status).send({ message: 'Error fetching file' });
418
}
419
420
- res.setHeader('Content-Disposition', `attachment; filename="${game.name}.zip"`);
+ // Sanitize the filename to remove invalid characters
421
+ const sanitizedFilename = game.name.replace(/[^a-zA-Z0-9-_\.]/g, '_');
422
+ res.setHeader('Content-Disposition', `attachment; filename="${sanitizedFilename}.zip"`);
423
res.setHeader('Content-Type', fileRes.headers.get('content-type') || 'application/octet-stream');
424
425
const contentLength = fileRes.headers.get('content-length');
0 commit comments