From e4eafa4528c2efe39ea71c0a32b9c3904d07f4ce Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sat, 10 Jan 2026 02:27:33 +0100 Subject: [PATCH] fix(ui): correct amountless invoice detection in bolt11 decoder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bolt11 decoder returns the string 'Any amount' for amountless invoices, not null or 0. The previous check failed because non-empty strings are truthy in JavaScript. Changed detection from: !amount || amount === 0 To: typeof amount !== 'number' || amount <= 0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- lnbits/static/js/pages/wallet.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lnbits/static/js/pages/wallet.js b/lnbits/static/js/pages/wallet.js index 11ccf441..7e0877b6 100644 --- a/lnbits/static/js/pages/wallet.js +++ b/lnbits/static/js/pages/wallet.js @@ -308,16 +308,17 @@ window.PageWallet = { } // Check if invoice is amountless (no amount specified) + // The decoder returns 'Any amount' string for amountless invoices + const invoiceAmount = invoice.human_readable_part.amount const isAmountless = - !invoice.human_readable_part.amount || - invoice.human_readable_part.amount === 0 + typeof invoiceAmount !== 'number' || invoiceAmount <= 0 let cleanInvoice = { - msat: isAmountless ? null : invoice.human_readable_part.amount, - sat: isAmountless ? null : invoice.human_readable_part.amount / 1000, + msat: isAmountless ? null : invoiceAmount, + sat: isAmountless ? null : invoiceAmount / 1000, fsat: isAmountless ? this.$t('any_amount') - : LNbits.utils.formatSat(invoice.human_readable_part.amount / 1000), + : LNbits.utils.formatSat(invoiceAmount / 1000), bolt11: this.parse.data.request, isAmountless: isAmountless }