fix: handle callback URLs with ?

This commit is contained in:
blackcoffeexbt 2025-11-14 14:04:15 +00:00 committed by GitHub
parent 19eaf1a4e3
commit f77c228a02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -73,8 +73,9 @@ class LightningService {
comment
})
const zapRequest = await client.signer.signEvent(zapRequestDraft)
const separator = callback.includes('?') ? '&' : '?'
const zapRequestRes = await fetch(
`${callback}?amount=${amount}&nostr=${encodeURI(JSON.stringify(zapRequest))}&lnurl=${lnurl}`
`${callback}${separator}amount=${amount}&nostr=${encodeURI(JSON.stringify(zapRequest))}&lnurl=${lnurl}`
)
const zapRequestResBody = await zapRequestRes.json()
if (zapRequestResBody.error) {