mirror of
https://github.com/mempool/mempool.git
synced 2026-08-18 13:08:44 +02:00
Merge pull request #6246 from mempool/mononaut/qs-hotfix
hotfix for qs breaking query param change
This commit is contained in:
commit
0e6f9a7621
2 changed files with 10 additions and 16 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,17 +78,14 @@ class ChannelsRoutes {
|
|||
|
||||
private async $getChannelsByTransactionIds(req: Request, res: Response): Promise<void> {
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue