diff options
Diffstat (limited to 'names/lnurl-params.js')
| -rw-r--r-- | names/lnurl-params.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/names/lnurl-params.js b/names/lnurl-params.js new file mode 100644 index 0000000..9b04cbc --- /dev/null +++ b/names/lnurl-params.js @@ -0,0 +1,9 @@ +// Some LNURL clients (aqstr.com, 2026-12-04) append "?amount=…" to a callback +// that already has a query, so "cb?domain=coinos.io" arrives as +// "cb?domain=coinos.io?amount=21000": domain reads "coinos.io?amount=21000", +// the name is unknown and the payer gets a 404. +export function tolerantParams(search) { + // a literal "?" inside a query is only ever this mistake: a real one in a + // value arrives encoded (%3F). The first occurrence of a parameter wins. + return new URLSearchParams(String(search || '').replace(/^\?/, '').replace(/\?/g, '&')); +} |
