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

Keys of parsed JSON objects are escaped #14

Open
janikrabe opened this issue Feb 17, 2019 · 0 comments
Open

Keys of parsed JSON objects are escaped #14

janikrabe opened this issue Feb 17, 2019 · 0 comments

Comments

@janikrabe
Copy link
Contributor

The json::object::parse_pair function calls getQuoted to parse object keys. This means that object::_data contains JSON-escaped keys.

This causes the following issue in timewarrior as of GothenburgBitFactory/timewarrior@bdb28fa:

$ timew start '"a'
  Note: '"\"a"' is a new tag.
  Tracking "\"a"
    […]

$ timew stop
  Trying to decrement non-existent tag '"a'

After timew start is run, the tags.data file contains {"\"a":{"count":1}}. When running timew stop, libshared's parse_pair parses the key "\"a", but does not unescape it. This causes timewarrior not to find "a because the key is internally stored as \"a.

Possible solutions:

  • Add a function to retrieve the key name in unescaped form and change timewarrior to use this function
  • Change the internal representation of _data to store the unescaped string

Possibly related to GothenburgBitFactory/timewarrior#159

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

1 participant