GothenburgBitFactory / GothenburgBitFactory/libshared

Keys of parsed JSON objects are escaped

Open
#14 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
7
Forks
30
Avg merge
13h 17m
Merged PRs (30d)
1

Description

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@bdb28fa744f4e254713e30d6923426f7dc063718:

```
$ 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.