diff options
| author | Adam Soltys <[email protected]> | 2026-12-03 21:34:11 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-12-03 21:34:11 -0700 |
| commit | ac1999d50b83bd7a8d5068abebcb0e1756a63eeb (patch) | |
| tree | 4bb8c621f65305f8149e2744db116210912c7a60 /names/server.js | |
| parent | 8076d1323566fe90a43f857384e5e46c257c692a (diff) | |
| download | coinosv3-server-ac1999d50b83bd7a8d5068abebcb0e1756a63eeb.tar.gz coinosv3-server-ac1999d50b83bd7a8d5068abebcb0e1756a63eeb.zip | |
names: a Lightning address callback with a second "?" still finds the name.
"Payment failed: Unable to generate invoice from [email protected] (HTTP 500: Error processing request: HTTP error! status: 404)" from aqstr.com (Shark, relayed by Adam 2026-12-04). Some LNURL clients add the amount with "?" instead of "&", so our callback "cb?domain=coinos.io" arrived as "cb?domain=coinos.io?amount=21000": the domain read as "coinos.io?amount=21000", no name matched, and the payer got 404 "unknown address". On /lnurlp/ and /.well-known/lnurlp/ paths a literal "?" inside the query is now read as "&" (a real one in a value arrives encoded as %3F), and the first occurrence of a parameter wins. New lnurl-params.test.js passes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6WoqaQDYdpWkatPCar
Diffstat (limited to 'names/server.js')
| -rw-r--r-- | names/server.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/names/server.js b/names/server.js index 3e687c3..f12b08f 100644 --- a/names/server.js +++ b/names/server.js @@ -38,6 +38,7 @@ import { registrationIdentity } from './ownership.js'; import { openStore } from './store.js'; import { withdrawService } from './withdraw.js'; import { accountOf, accountBlockers, forgetAccount } from './forget.js'; +import { tolerantParams } from './lnurl-params.js'; import { migrateGrantRefusal } from './migrate-check.js'; const CFG = JSON.parse(readFileSync(process.env.NAMES_CONFIG @@ -1333,6 +1334,8 @@ Bun.serve({ port: CFG.port || 8798, async fetch(req, server) { const url = new URL(req.url); + // "cb?domain=coinos.io?amount=…" from clients that append with a second "?" + if (/^\/(?:\.well-known\/)?lnurlp\//.test(url.pathname) && url.search.indexOf('?', 1) > 0) url.search = tolerantParams(url.search).toString(); if (req.method === 'OPTIONS') return json({}); const ip = req.headers.get('cf-connecting-ip') || req.headers.get('x-forwarded-for') || 'local'; |
