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

take_index causing 'move' of incorrect values due to bad True==1 comparison #129

Comments

@Penguin2600
Copy link

Penguin2600 commented Mar 11, 2021

See test here that reproduces the issue in code:
https://gist.github.com/Penguin2600/bca88971424a13f45d3560acf0e60f45

Or simply look at this REPL output to understand the impact:
Taken from line 714 of jsonpatch.py:

(Pdb) self.index_storage[st].keys()  
dict_keys([0.0, 1.0, 10.7, 'yes'])
(Pdb) stored = self.index_storage[st].get(True) 
(Pdb) len(stored)
1

In plain English, if my source data has a 1 or 1.0 anywhere and my destination data has a True anywhere jsonpatch will want to move 1.0 into the JSON where a true should be. This causes validation failures and in general incorrect output as in JSON '1.0' and 'true' are not the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment