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

Unknown tag with map value decode issue #64

Open
solarw opened this issue Jan 10, 2023 · 2 comments
Open

Unknown tag with map value decode issue #64

solarw opened this issue Jan 10, 2023 · 2 comments

Comments

@solarw
Copy link

solarw commented Jan 10, 2023

Given: Encoded custom tag with value like: {"type": str, "value": str}.

cbor decode method returns Tag object with proper tag and value == {} (empty map).

if value is something like ["some", "str"], tag.value is correct. not for mapping

so on custom tag value decode, list and string are decoded properly, map is not.

checked payload with cbor playground, to check encoded properly.

looks like cbor-x issue

@solarw
Copy link
Author

solarw commented Jan 10, 2023

issue is not correct:

reason was I used

  function decode(data) {
    return new Decoder().decode(data);
  }

and in this case default options for decoding are not applied.
https://github.com/kriszyp/cbor-x/blob/master/decode.js#L39

assume to add

else {options = defaultOptions}

to make defeault options applied on new Decoder()

@kriszyp
Copy link
Owner

kriszyp commented Jan 12, 2023

The exported decode function has different defaults than creating a Decoder instance and using its decode method.

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