fix: Error returned from Code::Stats

Signed-off-by: Avior <f.bouillon@aptatio.com>
This commit is contained in:
Florian Bouillon 2022-12-07 16:23:57 +01:00
parent 9e81ea201d
commit e27d42d37d
Signed by: Florian Bouillon
GPG Key ID: E05B3A94178D3A7C

View File

@ -21,6 +21,12 @@ app.get('/', async (req, res) => {
// Generate the STL // Generate the STL
const bfr = await generateThingy(username, yearN) const bfr = await generateThingy(username, yearN)
if (!bfr) {
res.status(500)
.send('It seems the generator could not generate, Please open an issue on Github https://github.com/aviortheking/codestats-skyline/issues/new')
return
}
// force download the STL with a good name // force download the STL with a good name
res res
.setHeader('Content-Disposition', `attachment; filename=${username}-${year ? year : 'full'}.stl`) .setHeader('Content-Disposition', `attachment; filename=${username}-${year ? year : 'full'}.stl`)