Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work harder to find the Invoice #252

Open
HamishMacEwan opened this issue May 23, 2020 · 1 comment
Open

Work harder to find the Invoice #252

HamishMacEwan opened this issue May 23, 2020 · 1 comment

Comments

@HamishMacEwan
Copy link

Description of the Feature or Idea

Rather than interrupt the flow to announce the invoice is invalid (a trailing " " included in the copy, I'm sorry, let me highlight that again and copy it without the trailing blank) please do your best to find the invoice wherever it is in the input.

Existing Example(s) of Feature

https://lightning-wallet.com/ is a target for sharing on Android, and when I share:

{
  "invoice": "lnbc15360n1p0v3tzlpp58ns2xp7yues4dkag8483972mxx5l8d5fm63z2zpy5ljvdjr848kqdp9gf5hgsmvda6kguewwd5r5grpd3cxsctjvsknzxqr8pqcqp2rzjqds2g84cc0lqj7pw7mycft9mqqasu84uflss4cqm4v8gp4mxrry0gzvrcuqqnysqqqqqqq05qqqqqqgqpcg5f3w9vqh7dxf30e6wv2m5dcfg4h7zh8x22yuze3s400qe6zq0l3ktk5mqu2mw3ajw4vn0stsqe5jyw47kts4ssnp8v2353p4s5muvgpqxaclr"
}

It doesn't complain, it finds the invoice within the string and offers to pay it.

Joule, context menu on Windows 10, won't even appear if that JSON fragment is highlighted.

lnbc2500n1p0v3tfcpp566m57duyuz680stdg8kanfrrdn4dkr7u8sdffr47nzgzn8dh9klqdz4g9kx7mn6dusy6etwd9nxjetvvssz6gzyv4mxjm3qgdkxzuntyr3gdy3qg9xjpuyl37rzqj60ypdk5523xp346cqzpgxqrpcgsp5dprwurq06d48xc3gsuzd7gk60rsnq439p4grr8nsp50p6csuluus9qy9qsq9q5qklsmm2d3x4njq9dernkqn3nhqvpc4wvmlhpfex84fqhhvtryc65afhcurkhgsymkhyyue0kqqurraqtswe70zulch4tw9x79tygpc6dpwa

Joule appears for that string, trailing white space and all, then chokes:
chrome_Z8QB2dTwVS

I think this is case for the Robustness Principle, "Be conservative in what you send, be liberal in what you accept" https://en.wikipedia.org/wiki/Robustness_principle

@wbobeirne
Copy link
Member

Seems totally reasonable, I'll try to make a forgiving function for parsing invoices from user input, and use that everywhere I can. Thanks for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants