Skip to content

EnsurePathExistsOnAdd not working with escaped slash #217

Description

@LorenzBischof

When escaping a slash with ~1 the following error is printed when trying to add a nested path and using ensurePathExistsOnAdd:

patch_test.go:831: Unable to apply patch: add operation does not apply: doc is missing path: "/with~1slash/nested": missing value

The first test works, the second one fails:

        {
                `{ "foo": ["bar"]}`,
                `[ { "op": "add", "path": "/with~1slash", "value": "bar" } ]`,
                `{ "foo": ["bar"], "with/slash": "bar"}`,
                true,
                true,
        },
        {
                `{ "foo": ["bar"]}`,
                `[ { "op": "add", "path": "/with~1slash/nested", "value": "bar" } ]`,
                `{ "foo": ["bar"], "with/slash": { "nested": "bar"}}`,
                true,
                true,
        },

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions