From 9c34ee3b04b29c1c41f04b44be3f4003f8ee875e Mon Sep 17 00:00:00 2001 From: Mononaut Date: Thu, 29 Jan 2026 09:10:03 +0000 Subject: [PATCH] hotfix qs breaking query param change --- backend/src/api/bitcoin/bitcoin.routes.ts | 13 +++++-------- backend/src/api/explorer/channels.routes.ts | 13 +++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/backend/src/api/bitcoin/bitcoin.routes.ts b/backend/src/api/bitcoin/bitcoin.routes.ts index e6075ffa2..42ab9f935 100644 --- a/backend/src/api/bitcoin/bitcoin.routes.ts +++ b/backend/src/api/bitcoin/bitcoin.routes.ts @@ -143,17 +143,14 @@ class BitcoinRoutes { } private getTransactionTimes(req: Request, res: Response) { - if (!Array.isArray(req.query.txId)) { - handleError(req, res, 500, 'Not an array'); + if (!req.query.txId || typeof req.query.txId !== 'object') { + handleError(req, res, 500, 'invalid txId format'); return; } const txIds: string[] = []; - for (const _txId in req.query.txId) { - if (typeof req.query.txId[_txId] === 'string') { - const txid = req.query.txId[_txId].toString(); - if (TXID_REGEX.test(txid)) { - txIds.push(txid); - } + for (const txid of Object.values(req.query.txId)) { + if (typeof txid === 'string' && TXID_REGEX.test(txid)) { + txIds.push(txid); } } diff --git a/backend/src/api/explorer/channels.routes.ts b/backend/src/api/explorer/channels.routes.ts index 031aeea17..71bc77280 100644 --- a/backend/src/api/explorer/channels.routes.ts +++ b/backend/src/api/explorer/channels.routes.ts @@ -78,17 +78,14 @@ class ChannelsRoutes { private async $getChannelsByTransactionIds(req: Request, res: Response): Promise { try { - if (!Array.isArray(req.query.txId)) { - handleError(req, res, 400, 'Not an array'); + if (!req.query.txId || typeof req.query.txId !== 'object') { + handleError(req, res, 400, 'invalid txId format'); return; } const txIds: string[] = []; - for (const _txId in req.query.txId) { - if (typeof req.query.txId[_txId] === 'string') { - const txid = req.query.txId[_txId].toString(); - if (TXID_REGEX.test(txid)) { - txIds.push(txid); - } + for (const txid of Object.values(req.query.txId)) { + if (typeof txid === 'string' && TXID_REGEX.test(txid)) { + txIds.push(txid); } } const channels = await channelsApi.$getChannelsByTransactionId(txIds);