From ec97d51ab0de59ae8f376e8c3a6eef0610f3ca6d Mon Sep 17 00:00:00 2001 From: ale Date: Sun, 22 Sep 2024 01:30:52 +0200 Subject: [PATCH] download index --- lib/apiswagger.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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() } })