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

some nullbytes are added in the callback when write the card #40

Open
nicolasburtey opened this issue Sep 23, 2023 · 2 comments
Open

some nullbytes are added in the callback when write the card #40

nicolasburtey opened this issue Sep 23, 2023 · 2 comments

Comments

@nicolasburtey
Copy link

here is an example of a callback:

https://localhost:3000/api/ln?p=9E7F7FBADE31A687A8E8525773139055&c=886FDB3E8AA51797%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00

The code to remove it with node is:

  const raw_c = searchParams.get("c")
  const raw_c_decoded = decodeURIComponent(raw_c)
  const raw_c_nonullbytes = raw_c_decoded.replace(/\x00+$/, "")

not sure why this happen but not having those null value would be better.
took me a bit of time to debug this; this was the reason the callback was not working properly on my end initially.

@robertclarkson
Copy link
Member

This is a strange one but is actually intentional, this is due to compatibility with the either intentional-or-bug with the first ever implementation by Coin Corner.

Could potentially be to stop the NDEF being "recognised" by the operating system and redirecting to the browser or similar? maybe @PeterRounce has more info?

@robertclarkson
Copy link
Member

Actually sorry disregard this, I thought you were talking about null bytes at the start of the NDEF record. unsure where those null bytes are coming from exactly...

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