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

Wrong handling of JSON paths in brackets #4381

Open
MartinKolarik opened this issue Dec 28, 2024 · 1 comment
Open

Wrong handling of JSON paths in brackets #4381

MartinKolarik opened this issue Dec 28, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@MartinKolarik
Copy link

Describe the bug

When creating a new property in a JSON value:

  • the property is not created when using the bracket syntax ($.['testProp']),
  • if the property name starts with - character, a syntax error is returned.

To Reproduce
Steps to reproduce the behavior:

> json.set testKey $ {}
"OK"

> json.set testKey "$.['testProp']" 1
(nil) <-- THIS IS WRONG

> json.get testKey
"{}" <-- THE VALUE WAS NOT SET

> json.set testKey "$.testProp" 1
"OK" <-- NOT USING BRACKETS WORKS

> json.set testKey "$.['testProp']" 2
"OK" <-- IF THE KEY EXISTS, THIS WORKS TOO

> json.set testKey "$.['-testProp']" 1
"ERR syntax error" <-- THIS IS WRONG TOO 

Expected behavior

All of the above should work without errors.

Screenshots

Redis (all works):

image

Dragonfly:

image

Environment (please complete the following information):

  • OS: Ubuntu 24
  • Kernel: 5.15.153.1
  • Containerized?: Docker
  • Dragonfly Version: v1.26.0-c5ef553ffcc9f2f4070af4a3575c2ac0a4ccc035
@BagritsevichStepan
Copy link
Contributor

Hi @MartinKolarik, thank you for reporting this issue

@BagritsevichStepan BagritsevichStepan self-assigned this Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants