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

Bug report: DishJSON converts false and null to empty ArrayBuffer #998

Closed
Danh4 opened this issue Mar 28, 2020 · 1 comment
Closed

Bug report: DishJSON converts false and null to empty ArrayBuffer #998

Danh4 opened this issue Mar 28, 2020 · 1 comment
Labels

Comments

@Danh4
Copy link
Contributor

Danh4 commented Mar 28, 2020

Describe the bug
DishJSON line 20 uses this.value as tertiary conditional check before either stringifying the JSON or initialising a new ArrayBuffer. This means that valid JSON values of null and false are replaced with ArrayBuffer if they are the sole element.

To Reproduce
Steps to reproduce the behaviour or a link to the recipe / input used to cause the bug:

Create a recipe with From Hex and From MessagePack and enter the following inputs:

  1. C0 (null)
  2. C2 (false)
  3. C3 (true)

Expected behaviour

  1. C0 should display null in the output but displays nothing
  2. C2 should display false in the output but displays nothing
  3. C3 should and does correctly display true

Screenshots
N/A

Desktop (if relevant, please complete the following information):
N/A - applies to current head of master

Additional context
The fix should change the tertiary conditional check in DishJSON on line JSON from:

this.value = this.value ? Utils.strToArrayBuffer(JSON.stringify(this.value, null, 4)) : new ArrayBuffer;

to:

this.value = this.value !== undefined ? Utils.strToArrayBuffer(JSON.stringify(this.value, null, 4)) : new ArrayBuffer;

@n1474335
Copy link
Member

Closed in #1000

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

No branches or pull requests

2 participants