runcitadel / dashboard

Other
11 stars 5 forks source link

[Bug]: no feedback about invalid LN invoice #54

Open tril0byte opened 1 year ago

tril0byte commented 1 year ago

Describe the bug

when the invoice is pasted and it's wrong there's an error written to the log but not provided to the user. Actually the log is pretty clear saying "Must include only alpha numeric characters", this message should be presented to the user in red text near the field that contains the error.

Reproduce

  1. Log into Citadel
  2. click Lightning
  3. click Send
  4. paste an invoice that contains a space in it. Animation of a line moving back and forth will occur with no feedback about what is wrong.

Citadel version

0.1.3

Operating system

Debian

Log output

middleware         |   InternalServerError: Must include only alpha numeric characters.
middleware         |       at Object.throw (/app/node_modules/koa/lib/context.js:97:11)
middleware         |       at Module.isAlphanumeric (file:///app/node_modules/@runcitadel/utils/lib/typeHelper.js:15:18)
middleware         |       at file:///app/routes/v1/lnd/lightning.js:45:16
middleware         |       at dispatch (/app/node_modules/koa-compose/index.js:42:32)
middleware         |       at file:///app/middlewares/auth.js:44:15
middleware         |       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
tril0byte commented 1 year ago

it was actually a newline character that when pasting got turned into a space (showed as %20 in GET /api/v1/lnd/lightning/invoice?paymentRequest=). actually I don't know if the BOLTs say you need to support multi-line invoices but that would make some kind of sense, maybe the wallet should merge the lines together if this happens, but that might be more complicated to implement and an error would have worked for me.