diff --git a/lib/apiswagger.js b/lib/apiswagger.js index c650659..fde03ec 100644 --- a/lib/apiswagger.js +++ b/lib/apiswagger.js @@ -499,7 +499,7 @@ module.exports = (app, client) => { * application/octect-stream */ app.use('/api/download_index', async (req, res) => { - if (req.params.instance && req.params.instance.length > 0) { + try { const result = await client.search({ index: constant.index, size: 9999, @@ -512,7 +512,8 @@ module.exports = (app, client) => { 'Content-disposition': 'attachment; filename=fediblock-index.json.gz' }) result.pipe(zlib.createGzip()).pipe(res, { end: true }) - } else { + } catch (e) { + console.error(e) res.status(404).end() } })